Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A module to facilitate and demonstrate a programming pattern where application instances for a system is (co-)recursive.
Synopsis
- runCorecursiveApp :: MonadIO m => App m [String] arg FilePath () -> m ()
- callback :: MonadIO m => Self m [String] arg FilePath -> arg -> m ()
- readCallback :: MonadIO m => Self m [String] arg FilePath -> arg -> m String
- data App t msg arg inst ret
- data Self t msg arg inst
- app :: (msg -> m arg) -> (arg -> m msg) -> (Self m msg arg inst -> arg -> m ret) -> App m msg arg inst ret
Documentation
runCorecursiveApp :: MonadIO m => App m [String] arg FilePath () -> m () Source #
Run function for an App which arguments are read from the command line
using getArgs
and for which the binary is discovered from
getExecutablePath
.
callback :: MonadIO m => Self m [String] arg FilePath -> arg -> m () Source #
Callback running the Self executable locally and waiting until completion
using callProcess
.
readCallback :: MonadIO m => Self m [String] arg FilePath -> arg -> m String Source #
Callback running the Self executable locally and waiting until completion
using readProcess
.
re-exported for convenience
data App t msg arg inst ret Source #
A datatype wrapping everything needed to make a (co-)recursive main function.
Application authors may find this type useful because it has a Functor instance, allowing to adapt the result of a computation.
See app
.
data Self t msg arg inst Source #
A datatype representing an instance of the (co-)recursive program.
A reason why the records in this type are separate from App
is that a
calling program may need to execute a fair amount of progress
before knowing the right executable
(e.g., in the case of a remote
invocation). Also, sometimes one may want to adapt Self
.