miss-porcelain-0: Useability extras built on top of miss.

Safe HaskellNone
LanguageHaskell2010

Data.Git.EditTree

Description

An EditTree is a convenient representation of a Tree. The leaves of an EditTree are either the contents of a Blob, a sub-EditTree, or a Sha1. This makes it easier to work with large Trees, because subobjects are stored as hashes until you modify them.

Synopsis

Documentation

type EditTree = Map TreeEntry TreePart Source #

A nice representation of a Tree.

data TreePart Source #

The leaves of an EditTree---either a hash, Blob data, or a subtree.

Instances
Monad m => MonadState EditTree (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

get :: TreeEdit m EditTree #

put :: EditTree -> TreeEdit m () #

state :: (EditTree -> (a, EditTree)) -> TreeEdit m a #

newtype TreeEdit m a Source #

A monad for editing EditTrees.

Constructors

TreeEdit 

Fields

Instances
MonadTrans TreeEdit Source # 
Instance details

Defined in Data.Git.EditTree

Methods

lift :: Monad m => m a -> TreeEdit m a #

Monad m => MonadState EditTree (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

get :: TreeEdit m EditTree #

put :: EditTree -> TreeEdit m () #

state :: (EditTree -> (a, EditTree)) -> TreeEdit m a #

Monad m => Monad (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

(>>=) :: TreeEdit m a -> (a -> TreeEdit m b) -> TreeEdit m b #

(>>) :: TreeEdit m a -> TreeEdit m b -> TreeEdit m b #

return :: a -> TreeEdit m a #

fail :: String -> TreeEdit m a #

Functor m => Functor (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

fmap :: (a -> b) -> TreeEdit m a -> TreeEdit m b #

(<$) :: a -> TreeEdit m b -> TreeEdit m a #

MonadFail m => MonadFail (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

fail :: String -> TreeEdit m a #

Monad m => Applicative (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

pure :: a -> TreeEdit m a #

(<*>) :: TreeEdit m (a -> b) -> TreeEdit m a -> TreeEdit m b #

liftA2 :: (a -> b -> c) -> TreeEdit m a -> TreeEdit m b -> TreeEdit m c #

(*>) :: TreeEdit m a -> TreeEdit m b -> TreeEdit m b #

(<*) :: TreeEdit m a -> TreeEdit m b -> TreeEdit m a #

MonadIO m => MonadIO (TreeEdit m) Source # 
Instance details

Defined in Data.Git.EditTree

Methods

liftIO :: IO a -> TreeEdit m a #

loadEditTree :: (MonadGit m, MonadFail m) => Sha1 -> m EditTree Source #

Turn the given treeish Sha1 into an EditTree whose leaves are all hashes.

writeEditTree :: MonadGit m => EditTree -> m Sha1 Source #

Traverse an EditTree, writing new objects, and return the Sha1 of the new Tree.

don'tEditTree :: MonadGit m => EditTree -> TreeEdit m a -> m EditTree Source #

Run a TreeEdit computation against an EditTree, *without* writing the new objects out.

editTree :: MonadGit m => EditTree -> TreeEdit m a -> m EditTree Source #

Run a TreeEdit computation against an EditTree, writing new objects as they occur.

rm :: Monad m => TreeEntry -> TreeEdit m () Source #

Delete an entry from the EditTree.

cd :: (MonadFail m, MonadGit m) => RawFilePath -> TreeEdit m a -> TreeEdit m a Source #

Run a TreeEdit in the subtree at the given path.

cd' :: (MonadFail m, MonadGit m) => [PathComponent] -> TreeEdit m a -> TreeEdit m a Source #

As cd, but with a list of path components.

cd1 :: (MonadFail m, MonadGit m) => PathComponent -> TreeEdit m a -> TreeEdit m a Source #

A one-level version of cd.

create :: Monad m => TreeEntry -> TreePart -> TreeEdit m () Source #

Place a new leaf with the given filename.

mkdir :: MonadFail m => PathComponent -> TreeEdit m () Source #

Create a subtree with the given filename.

cdCreating :: (MonadFail m, MonadGit m) => RawFilePath -> TreeEdit m a -> TreeEdit m a Source #

Create a path into the tree and do some TreeEdits in that location.

cdCreating' :: (MonadFail m, MonadGit m) => [PathComponent] -> TreeEdit m a -> TreeEdit m a Source #

As cdCreating, but with a list of path components.

createFiles :: Monad m => Map PathComponent ByteString -> TreeEdit m () Source #

A shortcut to create a bunch of files at once.