aivika-transformers-6.0.0: Transformers for the Aivika simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Composite

Description

Tested with: GHC 8.0.1

It defines the Composite monad transformer that allows constructing components which can be then destroyed in case of need.

Synopsis

Composite Monad

data Composite m a Source #

It represents a composite which can be then destroyed in case of need.

Instances

Instances details
MonadTrans Composite Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

lift :: Monad m => m a -> Composite m a #

Monad m => MonadCompTrans Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

liftComp :: m a -> Composite m a Source #

Monad m => CompositeLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Monad m => DynamicsLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

liftDynamics :: Dynamics m a -> Composite m a Source #

Monad m => EventLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

liftEvent :: Event m a -> Composite m a Source #

Monad m => ParameterLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Monad m => SimulationLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Monad m => MonadFail (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

fail :: String -> Composite m a #

(Monad m, MonadFix (Event m)) => MonadFix (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

mfix :: (a -> Composite m a) -> Composite m a #

(Monad m, MonadIO (Event m)) => MonadIO (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

liftIO :: IO a -> Composite m a #

Monad m => Applicative (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

pure :: a -> Composite m a #

(<*>) :: Composite m (a -> b) -> Composite m a -> Composite m b #

liftA2 :: (a -> b -> c) -> Composite m a -> Composite m b -> Composite m c #

(*>) :: Composite m a -> Composite m b -> Composite m b #

(<*) :: Composite m a -> Composite m b -> Composite m a #

Monad m => Functor (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

fmap :: (a -> b) -> Composite m a -> Composite m b #

(<$) :: a -> Composite m b -> Composite m a #

Monad m => Monad (Composite m) Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

Methods

(>>=) :: Composite m a -> (a -> Composite m b) -> Composite m b #

(>>) :: Composite m a -> Composite m b -> Composite m b #

return :: a -> Composite m a #

class CompositeLift t m where Source #

A type class to lift the Composite computation to other computations.

Methods

liftComposite :: Composite m a -> t m a Source #

Lift the specified Composite computation to another computation.

Instances

Instances details
Monad m => CompositeLift Composite m Source # 
Instance details

Defined in Simulation.Aivika.Trans.Composite

runComposite :: Composite m a -> DisposableEvent m -> Event m (a, DisposableEvent m) Source #

Run the computation returning the result and some DisposableEvent that being applied destroys the composite, for example, unsubscribes from signals or cancels the processes.

runComposite_ :: Monad m => Composite m a -> Event m a Source #

Like runComposite but retains the composite parts during the simulation.

runCompositeInStartTime_ :: MonadDES m => Composite m a -> Simulation m a Source #

Like runComposite_ but runs the computation in the start time.

runCompositeInStopTime_ :: MonadDES m => Composite m a -> Simulation m a Source #

Like runComposite_ but runs the computation in the stop time.

disposableComposite :: Monad m => DisposableEvent m -> Composite m () Source #

When destroying the composite, the specified action will be applied.