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

License | BSD3 |

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

Stability | experimental |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

Tested with: GHC 7.8.3

The module defines the `DynamicsT`

monad tranformer representing a time varying polymorphic function.

- data Dynamics m a
- class DynamicsLift t where
- liftDynamics :: MonadComp m => Dynamics m a -> t m a

- runDynamicsInStartTime :: Dynamics m a -> Simulation m a
- runDynamicsInStopTime :: Dynamics m a -> Simulation m a
- runDynamicsInIntegTimes :: Monad m => Dynamics m a -> Simulation m [m a]
- runDynamicsInTime :: Double -> Dynamics m a -> Simulation m a
- runDynamicsInTimes :: Monad m => [Double] -> Dynamics m a -> Simulation m [m a]
- catchDynamics :: (MonadComp m, Exception e) => Dynamics m a -> (e -> Dynamics m a) -> Dynamics m a
- finallyDynamics :: MonadComp m => Dynamics m a -> Dynamics m b -> Dynamics m a
- throwDynamics :: (MonadComp m, Exception e) => e -> Dynamics m a
- time :: Monad m => Dynamics m Double
- isTimeInteg :: Monad m => Dynamics m Bool
- integIteration :: Monad m => Dynamics m Int
- integPhase :: Monad m => Dynamics m Int

# Dynamics Monad

A value in the `Dynamics`

monad represents a polymorphic time varying function
defined in the whole spectrum of time values as a single entity. It is ideal for
numerical approximating integrals.

MonadTrans Dynamics | |

MonadCompTrans Dynamics | |

ParameterLift Dynamics | |

SimulationLift Dynamics | |

DynamicsLift Dynamics | |

MonadComp m => ResultComputing Dynamics m | |

Monad m => Monad (Dynamics m) | |

Functor m => Functor (Dynamics m) | |

MonadFix m => MonadFix (Dynamics m) | |

Applicative m => Applicative (Dynamics m) | |

MonadIO m => MonadIO (Dynamics m) | |

(Floating a, Monad m) => Floating (Dynamics m a) | |

(Fractional a, Monad m) => Fractional (Dynamics m a) | |

(Num a, Monad m) => Num (Dynamics m a) |

class DynamicsLift t where Source

A type class to lift the `Dynamics`

computations into other computations.

liftDynamics :: MonadComp m => Dynamics m a -> t m a Source

Lift the specified `Dynamics`

computation into another computation.

runDynamicsInStartTime :: Dynamics m a -> Simulation m a Source

Run the `Dynamics`

computation in the initial time point.

runDynamicsInStopTime :: Dynamics m a -> Simulation m a Source

Run the `Dynamics`

computation in the final time point.

runDynamicsInIntegTimes :: Monad m => Dynamics m a -> Simulation m [m a] Source

Run the `Dynamics`

computation in all integration time points.

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

Run the `Dynamics`

computation in the specified time point.

runDynamicsInTimes :: Monad m => [Double] -> Dynamics m a -> Simulation m [m a] Source

Run the `Dynamics`

computation in the specified time points.

# Error Handling

catchDynamics :: (MonadComp m, Exception e) => Dynamics m a -> (e -> Dynamics m a) -> Dynamics m a Source

Exception handling within `Dynamics`

computations.

finallyDynamics :: MonadComp m => Dynamics m a -> Dynamics m b -> Dynamics m a Source

A computation with finalization part like the `finally`

function.

throwDynamics :: (MonadComp m, Exception e) => e -> Dynamics m a Source

Like the standard `throw`

function.

# Simulation Time

isTimeInteg :: Monad m => Dynamics m Bool Source

Whether the current time is an integration time.

integIteration :: Monad m => Dynamics m Int Source

Return the integration iteration closest to the current simulation time.

integPhase :: Monad m => Dynamics m Int Source

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

for non-integration time points.