darcs-2.16.5: a distributed, interactive, smart revision control system

Safe Haskell | Safe-Inferred
Language | Haskell2010

Darcs.Patch.ApplyMonad

Synopsis

- class (Monad m, Monad (ApplyMonadBase m), ApplyMonadStateOperations state m, ToTree state) => ApplyMonad (state :: (* -> *) -> *) m where
  - type ApplyMonadBase m :: * -> *
  - nestedApply :: m x -> state (ApplyMonadBase m) -> m (x, state (ApplyMonadBase m))
  - liftApply :: (state (ApplyMonadBase m) -> ApplyMonadBase m x) -> state (ApplyMonadBase m) -> m (x, state (ApplyMonadBase m))
  - getApplyState :: m (state (ApplyMonadBase m))
- class (Monad m, ApplyMonad state (ApplyMonadOver state m)) => ApplyMonadTrans (state :: (* -> *) -> *) m where
  - type ApplyMonadOver state m :: * -> *
  - runApplyMonad :: ApplyMonadOver state m x -> state m -> m (x, state m)
- class ApplyMonadState (state :: (* -> *) -> *) where
  - type ApplyMonadStateOperations state :: (* -> *) -> Constraint
- withFileNames :: Maybe [OrigFileNameOf] -> [AnchoredPath] -> FilePathMonad a -> FilePathMonadState
- withFiles :: [(AnchoredPath, ByteString)] -> RestrictedApply a -> [(AnchoredPath, ByteString)]
- class ToTree s where
  - toTree :: s m -> Tree m
- class Monad m => ApplyMonadTree m where
  - mDoesDirectoryExist :: AnchoredPath -> m Bool
  - mDoesFileExist :: AnchoredPath -> m Bool
  - mReadFilePS :: AnchoredPath -> m ByteString
  - mCreateDirectory :: AnchoredPath -> m ()
  - mRemoveDirectory :: AnchoredPath -> m ()
  - mCreateFile :: AnchoredPath -> m ()
  - mRemoveFile :: AnchoredPath -> m ()
  - mRename :: AnchoredPath -> AnchoredPath -> m ()
  - mModifyFilePS :: AnchoredPath -> (ByteString -> m ByteString) -> m ()
  - mChangePref :: String -> String -> String -> m ()

# Documentation

class (Monad m, Monad (ApplyMonadBase m), ApplyMonadStateOperations state m, ToTree state) => ApplyMonad (state :: (* -> *) -> *) m where #

Associated Types

type ApplyMonadBase m :: * -> * #

Methods

nestedApply :: m x -> state (ApplyMonadBase m) -> m (x, state (ApplyMonadBase m)) #

liftApply :: (state (ApplyMonadBase m) -> ApplyMonadBase m x) -> state (ApplyMonadBase m) -> m (x, state (ApplyMonadBase m)) #

getApplyState :: m (state (ApplyMonadBase m)) #

#### Instances

Instances details

ApplyMonad Tree DefaultIO # |
Instance details Defined in Darcs.Repository.ApplyPatches Associated Types type ApplyMonadBase DefaultIO :: Type -> Type # Methods nestedApply :: DefaultIO x -> Tree (ApplyMonadBase DefaultIO) -> DefaultIO (x, Tree (ApplyMonadBase DefaultIO)) # liftApply :: (Tree (ApplyMonadBase DefaultIO) -> ApplyMonadBase DefaultIO x) -> Tree (ApplyMonadBase DefaultIO) -> DefaultIO (x, Tree (ApplyMonadBase DefaultIO)) # getApplyState :: DefaultIO (Tree (ApplyMonadBase DefaultIO)) #
Monad m => ApplyMonad Tree (TreeMonad m) # |
Instance details Defined in Darcs.Patch.ApplyMonad Associated Types type ApplyMonadBase (TreeMonad m) :: Type -> Type # Methods nestedApply :: TreeMonad m x -> Tree (ApplyMonadBase (TreeMonad m)) -> TreeMonad m (x, Tree (ApplyMonadBase (TreeMonad m))) # liftApply :: (Tree (ApplyMonadBase (TreeMonad m)) -> ApplyMonadBase (TreeMonad m) x) -> Tree (ApplyMonadBase (TreeMonad m)) -> TreeMonad m (x, Tree (ApplyMonadBase (TreeMonad m))) # getApplyState :: TreeMonad m (Tree (ApplyMonadBase (TreeMonad m))) #
Monad m => ApplyMonad ObjectMap (StateT (ObjectMap m) m) # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Apply Associated Types type ApplyMonadBase (StateT (ObjectMap m) m) :: Type -> Type # Methods nestedApply :: StateT (ObjectMap m) m x -> ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m)) -> StateT (ObjectMap m) m (x, ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m))) # liftApply :: (ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m)) -> ApplyMonadBase (StateT (ObjectMap m) m) x) -> ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m)) -> StateT (ObjectMap m) m (x, ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m))) # getApplyState :: StateT (ObjectMap m) m (ObjectMap (ApplyMonadBase (StateT (ObjectMap m) m))) #

class (Monad m, ApplyMonad state (ApplyMonadOver state m)) => ApplyMonadTrans (state :: (* -> *) -> *) m where #

Associated Types

type ApplyMonadOver state m :: * -> * #

Methods

runApplyMonad :: ApplyMonadOver state m x -> state m -> m (x, state m) #

#### Instances

Instances details

Monad m => ApplyMonadTrans ObjectMap m # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Apply Associated Types type ApplyMonadOver ObjectMap m :: Type -> Type # Methods runApplyMonad :: ApplyMonadOver ObjectMap m x -> ObjectMap m -> m (x, ObjectMap m) #
Monad m => ApplyMonadTrans Tree m # |
Instance details Defined in Darcs.Patch.ApplyMonad Associated Types type ApplyMonadOver Tree m :: Type -> Type # Methods runApplyMonad :: ApplyMonadOver Tree m x -> Tree m -> m (x, Tree m) #

class ApplyMonadState (state :: (* -> *) -> *) #

Associated Types

type ApplyMonadStateOperations state :: (* -> *) -> Constraint #

#### Instances

Instances details

ApplyMonadState ObjectMap # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Apply Associated Types type ApplyMonadStateOperations ObjectMap :: (Type -> Type) -> Constraint #
ApplyMonadState Tree # |
Instance details Defined in Darcs.Patch.ApplyMonad Associated Types type ApplyMonadStateOperations Tree :: (Type -> Type) -> Constraint #

withFileNames :: Maybe [OrigFileNameOf] -> [AnchoredPath] -> FilePathMonad a -> FilePathMonadState #

withFileNames takes a maybe list of existing rename-pairs, a list of filenames and an action, and returns the resulting triple of affected files, updated filename list and new rename details. If the rename-pairs are not present, a new list is generated from the filesnames.

withFiles :: [(AnchoredPath, ByteString)] -> RestrictedApply a -> [(AnchoredPath, ByteString)] #

class ToTree s where #

Methods

toTree :: s m -> Tree m #

#### Instances

Instances details

ToTree ObjectMap # |
Instance details Defined in Darcs.Patch.Prim.FileUUID.Apply Methods toTree :: forall (m :: Type -> Type). ObjectMap m -> Tree m #
ToTree Tree # |
Instance details Defined in Darcs.Patch.ApplyMonad Methods toTree :: forall (m :: Type -> Type). Tree m -> Tree m #

class Monad m => ApplyMonadTree m where #

Minimal complete definition

mDoesDirectoryExist, mDoesFileExist, mReadFilePS, mCreateDirectory, mRemoveDirectory, mRemoveFile, mRename, mModifyFilePS

Methods

mDoesDirectoryExist :: AnchoredPath -> m Bool #

mDoesFileExist :: AnchoredPath -> m Bool #

mReadFilePS :: AnchoredPath -> m ByteString #

mCreateDirectory :: AnchoredPath -> m () #

mRemoveDirectory :: AnchoredPath -> m () #

mCreateFile :: AnchoredPath -> m () #

mRemoveFile :: AnchoredPath -> m () #

mRename :: AnchoredPath -> AnchoredPath -> m () #

mModifyFilePS :: AnchoredPath -> (ByteString -> m ByteString) -> m () #

mChangePref :: String -> String -> String -> m () #

#### Instances

Instances details

ApplyMonadTree DefaultIO # |
Instance details Defined in Darcs.Repository.ApplyPatches Methods mDoesDirectoryExist :: AnchoredPath -> DefaultIO Bool # mDoesFileExist :: AnchoredPath -> DefaultIO Bool # mReadFilePS :: AnchoredPath -> DefaultIO ByteString # mCreateDirectory :: AnchoredPath -> DefaultIO () # mRemoveDirectory :: AnchoredPath -> DefaultIO () # mCreateFile :: AnchoredPath -> DefaultIO () # mRemoveFile :: AnchoredPath -> DefaultIO () # mRename :: AnchoredPath -> AnchoredPath -> DefaultIO () # mModifyFilePS :: AnchoredPath -> (ByteString -> DefaultIO ByteString) -> DefaultIO () # mChangePref :: String -> String -> String -> DefaultIO () #
Monad m => ApplyMonadTree (TreeMonad m) # |
Instance details Defined in Darcs.Patch.ApplyMonad Methods mDoesDirectoryExist :: AnchoredPath -> TreeMonad m Bool # mDoesFileExist :: AnchoredPath -> TreeMonad m Bool # mReadFilePS :: AnchoredPath -> TreeMonad m ByteString # mCreateDirectory :: AnchoredPath -> TreeMonad m () # mRemoveDirectory :: AnchoredPath -> TreeMonad m () # mCreateFile :: AnchoredPath -> TreeMonad m () # mRemoveFile :: AnchoredPath -> TreeMonad m () # mRename :: AnchoredPath -> AnchoredPath -> TreeMonad m () # mModifyFilePS :: AnchoredPath -> (ByteString -> TreeMonad m ByteString) -> TreeMonad m () # mChangePref :: String -> String -> String -> TreeMonad m () #