aivika-6.1: A multi-method 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.Composite

Description

Tested with: GHC 8.0.1

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

Synopsis

Composite Monad

data Composite a Source #

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

Instances

Instances details
CompositeLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

DynamicsLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

EventLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

liftEvent :: Event a -> Composite a Source #

ParameterLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

SimulationLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

MonadFail Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

fail :: String -> Composite a #

MonadFix Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

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

MonadIO Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

liftIO :: IO a -> Composite a #

Applicative Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

pure :: a -> Composite a #

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

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

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

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

Functor Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

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

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

Monad Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

Methods

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

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

return :: a -> Composite a #

class CompositeLift m where Source #

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

Methods

liftComposite :: Composite a -> m a Source #

Lift the specified Composite computation to another computation.

Instances

Instances details
CompositeLift Composite Source # 
Instance details

Defined in Simulation.Aivika.Composite

runComposite :: Composite a -> DisposableEvent -> Event (a, DisposableEvent) 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_ :: Composite a -> Event a Source #

Like runComposite but retains the composite parts during the simulation.

runCompositeInStartTime_ :: Composite a -> Simulation a Source #

Like runComposite_ but runs the computation in the start time.

runCompositeInStopTime_ :: Composite a -> Simulation a Source #

Like runComposite_ but runs the computation in the stop time.

disposableComposite :: DisposableEvent -> Composite () Source #

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