Defines the main Build
monad and common utils.
- module BuildBox.Build.Testable
- type Build a = ErrorT BuildError (ReaderT BuildConfig IO) a
- data BuildError
- = ErrorOther String
- | ErrorSystemCmdFailed { }
- | ErrorIOError IOError
- | forall prop . Show prop => ErrorCheckFailed Bool prop
- data BuildConfig = BuildConfig {}
- buildConfigDefault :: BuildConfig
- runBuild :: Build a -> IO (Either BuildError a)
- runBuildPrint :: Build a -> IO (Maybe a)
- runBuildPrintWithConfig :: BuildConfig -> Build a -> IO (Maybe a)
- throw :: BuildError -> Build a
- io :: IO a -> Build a
- logSystem :: String -> Build ()
- out :: Pretty a => a -> Build ()
- outLn :: Pretty a => a -> Build ()
- outBlank :: Build ()
- outLine :: Build ()
- outLINE :: Build ()
- whenM :: Monad m => m Bool -> m () -> m ()
Documentation
module BuildBox.Build.Testable
type Build a = ErrorT BuildError (ReaderT BuildConfig IO) aSource
The builder monad encapsulates and IO action that can fail with an error, and also read some global configuration info.
data BuildError Source
The errors we recognise.
ErrorOther String | Some generic error |
ErrorSystemCmdFailed | Some system command fell over, and it barfed out the given stdout and stderr. |
ErrorIOError IOError | Some other IO action failed. |
forall prop . Show prop => ErrorCheckFailed Bool prop | Some property |
data BuildConfig Source
Global builder configuration.
BuildConfig | |
|
buildConfigDefault :: BuildConfigSource
The default build config.
runBuildPrint :: Build a -> IO (Maybe a)Source
Run a build command, reporting whether it succeeded to the console. If it succeeded then return Just the result, else Nothing.
runBuildPrintWithConfig :: BuildConfig -> Build a -> IO (Maybe a)Source
Like runBuildPrintWithConfig
but also takes a BuildConfig
.
throw :: BuildError -> Build aSource
Throw an error in the build monad.
Lift an IO action into the build monad.
If the action throws any exceptions they get caught and turned into
ErrorIOError
exceptions in our Build
monad.