Safe Haskell | None |
---|---|
Language | Haskell98 |
Short-circuiting monad transformer and the corresponding generalizing monad type class.
- class Monad μ => MonadFinish f μ | μ -> f where
- type Finish f α = FinishT f Identity α
- runFinish :: Finish f α -> Either f α
- runFinish' :: Finish α α -> α
- newtype FinishT f (μ :: * -> *) α :: * -> (* -> *) -> * -> * = FinishT {
- runFinishT :: μ (Either f α)
- runFinishT' :: Monad μ => FinishT α μ α -> μ α
- module Control.Monad
- module Control.Monad.Fix
- module Control.Monad.Trans
Documentation
class Monad μ => MonadFinish f μ | μ -> f where Source #
Class of monads that support short-circuiting.
Short-circuit the computation with the provided value.
finish f >>= rest = finish f
MonadFinish f μ => MonadFinish f (ListT μ) Source # | |
MonadFinish f μ => MonadFinish f (MaybeT μ) Source # | |
(MonadFinish f μ, Monoid w) => MonadFinish f (WriterT w μ) Source # | |
(MonadFinish f μ, Monoid w) => MonadFinish f (WriterT w μ) Source # | |
MonadFinish f μ => MonadFinish f (StateT s μ) Source # | |
MonadFinish f μ => MonadFinish f (StateT s μ) Source # | |
MonadFinish f μ => MonadFinish f (AbortT e μ) Source # | |
MonadFinish f μ => MonadFinish f (ExceptT e μ) Source # | |
(MonadFinish f μ, Error e) => MonadFinish f (ErrorT e μ) Source # | |
MonadFinish f μ => MonadFinish f (IdentityT * μ) Source # | |
Monad μ => MonadFinish f (FinishT f μ) Source # | |
MonadFinish f μ => MonadFinish f (ReaderT * r μ) Source # | |
MonadFinish f μ => MonadFinish f (ContT * r μ) Source # | |
(MonadFinish f μ, Monoid w) => MonadFinish f (RWST r w s μ) Source # | |
(MonadFinish f μ, Monoid w) => MonadFinish f (RWST r w s μ) Source # | |
runFinish' :: Finish α α -> α #
runFinishT'
specialized to Finish
.
newtype FinishT f (μ :: * -> *) α :: * -> (* -> *) -> * -> * #
A monad transformer that extends monad μ
with the ability
to short-circuit computations with a value of type f
.
runFinishT
$ do someStuffwhen
condition $finish
reason otherwiseContinue
FinishT | |
|
runFinishT' :: Monad μ => FinishT α μ α -> μ α #
A version of runFinishT
for the cases where you don't need to
distinguish between short-circuits and regular computation results.
module Control.Monad
module Control.Monad.Fix
module Control.Monad.Trans