objective-1.0.2: Extensible objects

Safe HaskellTrustworthy
LanguageHaskell2010

Control.Object.Mortal

Contents

Synopsis

Documentation

newtype Mortal f g a Source

Object with a final result.

Object f g ≡ Mortal f g Void

Constructors

Mortal 

Fields

unMortal :: Object f (EitherT a g)
 

Instances

MonadTrans (Mortal f) 
Monad m => Monad (Mortal f m) 
(Functor m, Monad m) => Functor (Mortal f m) 
(Functor m, Monad m) => Applicative (Mortal f m) 

mortal :: (forall x. f x -> EitherT a m (x, Mortal f m a)) -> Mortal f m a Source

Construct a mortal in a Object construction manner.

mortal_ :: Object f (EitherT () g) -> Mortal f g () Source

Restricted Mortal constuctor which can be applied to transit, fromFoldable without ambiguousness.

runMortal :: Mortal f m a -> f x -> EitherT 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 immortal into a mortal with eternal life.

apprise :: (Witherable t, Monad m, Applicative m) => f a -> StateT (t (Mortal f m r)) m ([a], [r]) Source

Send a message to mortals in a container.

apprises :: (Witherable t, Monad m, Applicative 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 container.

apprises' :: (Witherable t, Monad m, Applicative m, Monoid r) => f a -> (a -> r) -> StateT (t (Mortal f m b)) m r Source

Like apprises, but ignores the final results.

apprises_ :: (Witherable t, Monad m, Applicative m, Monoid r) => f a -> (b -> r) -> StateT (t (Mortal f m b)) m r Source

Like apprises, but ignores the result.

Combinators

gatherFst :: Monoid r => (a -> r) -> ((a -> r) -> (b -> r) -> k) -> k Source

gatherSnd :: Monoid r => (b -> r) -> ((a -> r) -> (b -> r) -> k) -> k Source

buildSingle :: Functor f => ((a -> Endo [a]) -> f (Endo [a])) -> f [a] Source

buildBoth :: Functor f => ((a -> (Endo [a], Endo [b])) -> (b -> (Endo [a], Endo [b])) -> f (Endo [a], Endo [b])) -> f ([a], [b]) Source