Copyright | (c) Fumiaki Kinoshita 2015 |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Stability | provisional |
Portability | GADTs, Rank2Types |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- newtype Mortal f g a = Mortal {}
- mortal :: Monad m => (forall x. f x -> ExceptT a m (x, Mortal f m a)) -> Mortal f m a
- mortal_ :: Object f (ExceptT () g) -> Mortal f g ()
- runMortal :: Monad m => Mortal f m a -> f x -> ExceptT a m (x, Mortal f m a)
- immortal :: Monad m => Object f m -> Mortal f m x
- apprises :: (Witherable t, Monad m, Monoid r) => f a -> (a -> r) -> (b -> r) -> StateT (t (Mortal f m b)) m r
- apprise :: (Witherable t, Monad m) => f a -> StateT (t (Mortal f m r)) m ([a], [r])
Documentation
A Mortal
is an object that may die.
A mortal yields a final result upon death.
forms a Mortal
f gMonad
:
return
is a dead object and (>>=
) prolongs the life of the left object.
Object f g ≡ Mortal f g Void
mortal :: Monad m => (forall x. f x -> ExceptT a m (x, Mortal f m a)) -> Mortal f m a Source #
Construct a mortal in a Object
construction manner.
mortal_ :: Object f (ExceptT () g) -> Mortal f g () Source #
A smart constructor of Mortal
where the result type is restricted to ()
runMortal :: Monad m => Mortal f m a -> f x -> ExceptT a m (x, Mortal f m a) Source #
Send a message to a mortal.
immortal :: Monad m => Object f m -> Mortal f m x Source #
Turn an object into a mortal without death.
apprises :: (Witherable t, Monad m, Monoid r) => f a -> (a -> r) -> (b -> r) -> StateT (t (Mortal f m b)) m r Source #
Send a message to mortals in a Witherable
container.