achille-0.0.0: A library for building static site generators
Safe HaskellNone
LanguageHaskell2010

Achille.Recipe

Description

Core recipes including reading files, saving them.

Synopsis

Documentation

data Recipe m a b Source #

Description of a computation producing a value b given some input a.

Instances

Instances details
Monad m => Monad (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

(>>=) :: Recipe m a a0 -> (a0 -> Recipe m a b) -> Recipe m a b #

(>>) :: Recipe m a a0 -> Recipe m a b -> Recipe m a b #

return :: a0 -> Recipe m a a0 #

Functor m => Functor (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

fmap :: (a0 -> b) -> Recipe m a a0 -> Recipe m a b #

(<$) :: a0 -> Recipe m a b -> Recipe m a a0 #

MonadFail m => MonadFail (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

fail :: String -> Recipe m a a0 #

Monad m => Applicative (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

pure :: a0 -> Recipe m a a0 #

(<*>) :: Recipe m a (a0 -> b) -> Recipe m a a0 -> Recipe m a b #

liftA2 :: (a0 -> b -> c) -> Recipe m a a0 -> Recipe m a b -> Recipe m a c #

(*>) :: Recipe m a a0 -> Recipe m a b -> Recipe m a b #

(<*) :: Recipe m a a0 -> Recipe m a b -> Recipe m a a0 #

MonadIO m => MonadIO (Recipe m a) Source # 
Instance details

Defined in Achille.Internal

Methods

liftIO :: IO a0 -> Recipe m a a0 #

(Monad m, Semigroup b) => Semigroup (Recipe m a b) Source # 
Instance details

Defined in Achille.Internal

Methods

(<>) :: Recipe m a b -> Recipe m a b -> Recipe m a b #

sconcat :: NonEmpty (Recipe m a b) -> Recipe m a b #

stimes :: Integral b0 => b0 -> Recipe m a b -> Recipe m a b #

(Monad m, Monoid b) => Monoid (Recipe m a b) Source # 
Instance details

Defined in Achille.Internal

Methods

mempty :: Recipe m a b #

mappend :: Recipe m a b -> Recipe m a b -> Recipe m a b #

mconcat :: [Recipe m a b] -> Recipe m a b #

liftIO :: MonadIO m => IO a -> m a #

Lift a computation from the IO monad.

getInput :: Applicative m => Recipe m a a Source #

Recipe returning its input.

getCurrentDir :: Applicative m => Recipe m a FilePath Source #

Recipe for retrieving the current directory

readText :: AchilleIO m => Recipe m FilePath Text Source #

Recipe retrieving the contents of the input file as text

readBS :: AchilleIO m => Recipe m FilePath ByteString Source #

Recipe retrieving the contents of the input file as a bytestring.

saveFile :: (AchilleIO m, Writable m a) => a -> Recipe m FilePath FilePath Source #

Recipe for saving a value to the location given as input. Returns the input filepath as is.

saveFileAs :: (AchilleIO m, Writable m a) => (FilePath -> FilePath) -> a -> Recipe m FilePath FilePath Source #

Recipe for saving a value to a file, using the path modifier applied to the input filepath. Returns the path of the output file.

copyFile :: AchilleIO m => Recipe m FilePath FilePath Source #

Recipe for copying an input file to the same location in the output dir.

copyFileAs :: AchilleIO m => (FilePath -> FilePath) -> Recipe m FilePath FilePath Source #

Recipe for copying an input file to the output dir, using the path modifier.

copy :: AchilleIO m => FilePath -> FilePath -> Recipe m a FilePath Source #

Recipe for copying a file to a given destination. Returns the output filepath.

write :: (AchilleIO m, Writable m b) => FilePath -> b -> Recipe m a FilePath Source #

Recipe for writing to a an output file. Returns the output filepath.

task :: Task m b -> Recipe m a b Source #

Make a recipe out of a task. The input will simply be discarded.

debug :: AchilleIO m => Show b => b -> Recipe m a () Source #

Recipe for printing a value to the console.

callCommand :: AchilleIO m => String -> Recipe m a () Source #

Recipe for running a shell command in a new process.

runCommandWith :: AchilleIO m => (FilePath -> FilePath) -> (FilePath -> FilePath -> String) -> Recipe m FilePath FilePath Source #

Recipe for running a shell command in a new process. The command is defined with an helper function which depends on an input filepath and the same filepath with a modifier applied.

Examples:

cp :: Recipe IO FilePath FilePath
cp = runCommandWith id (\a b -> "cp " <> a <> " " <> b)

toTimestamped :: Monad m => FilePath -> Recipe m a (Timestamped FilePath) Source #

Recipe that will retrieve the datetime contained in a filepath.