-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Specify Haskell project templates and generate files
--   
--   See initial blog post for explanation:
--   http://www.yesodweb.com/blog/2012/09/project-templates
@package project-template
@version 0.2.1.0

module Text.ProjectTemplate

-- | Create a template file from a stream of file/contents combinations.
--   
--   Since 0.1.0
createTemplate :: Monad m => ConduitM (FilePath, m ByteString) ByteString m ()

-- | Unpack a template to some destination. Destination is provided by the
--   first argument.
--   
--   The second argument allows you to modify the incoming stream, usually
--   to replace variables. For example, to replace PROJECTNAME with
--   myproject, you could use:
--   
--   
--   Data.Text.replace "PROJECTNAME" "myproject"
--   
--   
--   Note that this will affect both file contents and file names.
--   
--   Since 0.1.0
unpackTemplate :: forall (m :: Type -> Type) o. MonadThrow m => (FilePath -> ConduitM ByteString o m ()) -> (Text -> Text) -> ConduitM ByteString o m ()

-- | The first argument to unpackTemplate, specifying how to receive
--   a file.
--   
--   Since 0.1.0
type FileReceiver (m :: Type -> Type) = FilePath -> ConduitM ByteString Void m ()

-- | Receive files to a Writer monad in memory.
--   
--   
--   execWriter $ runExceptionT_ $ src $$ unpackTemplate receiveMem id
--   
--   
--   Since 0.1.0
receiveMem :: forall (m :: Type -> Type). MonadWriter (Map FilePath ByteString) m => FileReceiver m

-- | Receive files to the given folder on the filesystem.
--   
--   
--   unpackTemplate (receiveFS "some-destination") (T.replace "PROJECTNAME" "foo")
--   
--   
--   Since 0.1.0
receiveFS :: forall (m :: Type -> Type). MonadResource m => FilePath -> FileReceiver m

-- | Exceptions that can be thrown.
--   
--   Since 0.1.0
data ProjectTemplateException
InvalidInput :: Text -> ProjectTemplateException
BinaryLoopNeedsOneLine :: ProjectTemplateException
instance GHC.Internal.Exception.Type.Exception Text.ProjectTemplate.ProjectTemplateException
instance GHC.Internal.Show.Show Text.ProjectTemplate.ProjectTemplateException
