This module provides a monadic interface for commands.
Basically CmdM is like Cmd but is a monad, which means
you can chain effects as you like!
Transform an element program using CmdM into a normal element program.
Transform a document program using CmdM into a normal document program.
Transform an application program using CmdM into a normal application program.
Chains CmdMs.
If you have a CmdM a and a function which given
a a can give you a CmdM b depending on the value
of type a given to the function. Then andThen gives you
a CmdM b that will run the first CmdM and then apply
the function.
Laws
andThen pure = identityandThen (f >> pure) = map f(andThen f) >> (andThen g) = andThen (a -> andThen g (f a))Flipped version of ap. To be used like:
pure f |> flap arg1 |> flap arg2 ...Composition of monadic functions
Run the second argument, ignore the result, then run the first one. To be used in
first |> seq secondTransform a program using CmdM into a normal program.
Beware that batch operations might not do what you think. The execution order of messages and commands is not defined.
Send messages in batch
Monadic interface for commands.
A value of type
CmdM msgis an effectful computation that can perform commands and contains values of typemsg.