Safe Haskell | None |
---|---|
Language | Haskell2010 |
Core recipes including reading files, saving them.
Synopsis
- data Recipe m a b
- liftIO :: MonadIO m => IO a -> m a
- getInput :: Applicative m => Recipe m a a
- getCurrentDir :: Applicative m => Recipe m a FilePath
- readText :: AchilleIO m => Recipe m FilePath Text
- readBS :: AchilleIO m => Recipe m FilePath ByteString
- saveFile :: (AchilleIO m, Writable m a) => a -> Recipe m FilePath FilePath
- saveFileAs :: (AchilleIO m, Writable m a) => (FilePath -> FilePath) -> a -> Recipe m FilePath FilePath
- copyFile :: AchilleIO m => Recipe m FilePath FilePath
- copyFileAs :: AchilleIO m => (FilePath -> FilePath) -> Recipe m FilePath FilePath
- copy :: AchilleIO m => FilePath -> FilePath -> Recipe m a FilePath
- write :: (AchilleIO m, Writable m b) => FilePath -> b -> Recipe m a FilePath
- task :: Task m b -> Recipe m a b
- debug :: AchilleIO m => Show b => b -> Recipe m a ()
- callCommand :: AchilleIO m => String -> Recipe m a ()
- runCommandWith :: AchilleIO m => (FilePath -> FilePath) -> (FilePath -> FilePath -> String) -> Recipe m FilePath FilePath
- toTimestamped :: Monad m => FilePath -> Recipe m a (Timestamped FilePath)
Documentation
Description of a computation producing a value b given some input a.
Instances
Monad m => Monad (Recipe m a) Source # | |
Functor m => Functor (Recipe m a) Source # | |
MonadFail m => MonadFail (Recipe m a) Source # | |
Defined in Achille.Internal | |
Monad m => Applicative (Recipe m a) Source # | |
Defined in Achille.Internal | |
MonadIO m => MonadIO (Recipe m a) Source # | |
Defined in Achille.Internal | |
(Monad m, Semigroup b) => Semigroup (Recipe m a b) Source # | |
(Monad m, Monoid b) => Monoid (Recipe m a b) Source # | |
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.