Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|

License | BSD3 |

Maintainer | David Sorokin <david.sorokin@gmail.com> |

Stability | experimental |

Safe Haskell | None |

Language | Haskell2010 |

Tested with: GHC 8.0.1

The module defines the `Dynamics`

monad representing a time varying polymorphic function.

## Synopsis

- data Dynamics a
- class DynamicsLift m where
- runDynamicsInStartTime :: Dynamics a -> Simulation a
- runDynamicsInStopTime :: Dynamics a -> Simulation a
- runDynamicsInIntegTimes :: Dynamics a -> Simulation [IO a]
- runDynamicsInTime :: Double -> Dynamics a -> Simulation a
- runDynamicsInTimes :: [Double] -> Dynamics a -> Simulation [IO a]
- catchDynamics :: Exception e => Dynamics a -> (e -> Dynamics a) -> Dynamics a
- finallyDynamics :: Dynamics a -> Dynamics b -> Dynamics a
- throwDynamics :: Exception e => e -> Dynamics a
- time :: Dynamics Double
- isTimeInteg :: Dynamics Bool
- integIteration :: Dynamics Int
- integPhase :: Dynamics Int
- traceDynamics :: String -> Dynamics a -> Dynamics a

# Dynamics Monad

A value in the `Dynamics`

monad represents a polymorphic time varying function.

## Instances

class DynamicsLift m where Source #

A type class to lift the `Dynamics`

computations to other computations.

liftDynamics :: Dynamics a -> m a Source #

Lift the specified `Dynamics`

computation to another computation.

## Instances

DynamicsLift Dynamics Source # | |

Defined in Simulation.Aivika.Internal.Dynamics liftDynamics :: Dynamics a -> Dynamics a Source # | |

DynamicsLift Event Source # | |

Defined in Simulation.Aivika.Internal.Event liftDynamics :: Dynamics a -> Event a Source # | |

DynamicsLift Composite Source # | |

Defined in Simulation.Aivika.Composite liftDynamics :: Dynamics a -> Composite a Source # | |

DynamicsLift Cont Source # | |

Defined in Simulation.Aivika.Internal.Cont liftDynamics :: Dynamics a -> Cont a Source # | |

DynamicsLift Process Source # | |

Defined in Simulation.Aivika.Internal.Process liftDynamics :: Dynamics a -> Process a Source # |

runDynamicsInStartTime :: Dynamics a -> Simulation a Source #

Run the `Dynamics`

computation in the initial time point.

runDynamicsInStopTime :: Dynamics a -> Simulation a Source #

Run the `Dynamics`

computation in the final time point.

runDynamicsInIntegTimes :: Dynamics a -> Simulation [IO a] Source #

Run the `Dynamics`

computation in all integration time points.

runDynamicsInTime :: Double -> Dynamics a -> Simulation a Source #

Run the `Dynamics`

computation in the specified time point.

runDynamicsInTimes :: [Double] -> Dynamics a -> Simulation [IO a] Source #

Run the `Dynamics`

computation in the specified time points.

# Error Handling

catchDynamics :: Exception e => Dynamics a -> (e -> Dynamics a) -> Dynamics a Source #

Exception handling within `Dynamics`

computations.

finallyDynamics :: Dynamics a -> Dynamics b -> Dynamics a Source #

A computation with finalization part like the `finally`

function.

# Simulation Time

isTimeInteg :: Dynamics Bool Source #

Whether the current time is an integration time.

integIteration :: Dynamics Int Source #

Return the integration iteration closest to the current simulation time.

integPhase :: Dynamics Int Source #

Return the integration phase for the current simulation time.
It is `(-1)`

for non-integration time points.