hasim-0.1: Process-Based Discrete Event Simulation librarySource codeContentsIndex
Control.Hasim
Portabilityunportable
Stabilityexperimental
Maintainerjochem@functor.nl
Contents
Types
Simulation
Process
Actions
SimRun
Description
This module imports all relevant functions from Control.Hasim.* hiding implementation details.
Synopsis
type Time = Double
type Id = Int
data Simulation
type SimMonad a = StateT SimState IO a
mkAnonProcess :: SimMonad (Proc pkt ())
mkProcess :: String -> st -> SimMonad (Proc pkt st)
setAction :: Proc pkt st -> Action pkt st () -> SimMonad ()
createSimulation :: SimMonad () -> IO Simulation
data Proc pkt st
type Acceptor pkt st = pkt -> AcceptResult pkt st
data Process
data Action
data AcceptResult pkt st
= Refuse
| Parallel (st -> st)
| Interrupt (Action pkt st ())
module Control.Hasim.Action
runSimulation :: Simulation -> IO ()
Types
type Time = DoubleSource

The type that represents a time.

The type that represents a process identifier.

type Id = IntSource
Simulation
data Simulation Source
Data type representing a simulation.
type SimMonad a = StateT SimState IO aSource
The simulation monad called SimMonad. In this monad you can define a simulation to be run.
mkAnonProcess :: SimMonad (Proc pkt ())Source
Make an anonymous process.
mkProcessSource
::
=> StringThe name of the new process.
-> stThe initial state of the process.
-> SimMonad (Proc pkt st)
Make a process with a name. This name will be used in logging and error messages
setActionSource
::
=> Proc pkt stThe process of which the action should be set
-> Action pkt st ()The action to be set
-> SimMonad ()
Set the action of the process.
createSimulation :: SimMonad () -> IO SimulationSource
Create a simulation from a SimMonad (a simulation definition). If the simulation is invalid, error will be called.
Process
data Proc pkt st Source
A Proc st pkt is a process that potentially accepts packets of type pkt while maintaining state st.
show/hide Instances
Eq (Proc pkt st)
Ord (Proc pkt st)
Show (Proc pkt st)
type Acceptor pkt st = pkt -> AcceptResult pkt stSource
An acceptor of a pkt is an AcceptResult, which is either * Refuse if the packet is to be delivered at a later time, or never, of course * Parallel act if a current computation should not be suspended, but the state should be changed. * Interrupt act if the current computation should be suspended.
data Process Source
Existential type for a Proc. A Process is a Proc pkt for some pkt.
show/hide Instances
data Action Source
The Action GADT. This is a GADT with three parameters; an Action pkt st a is a action where * pkt denotes the packet type of incoming packets * st denotes the state that can be modified and inspected * a denotes the result value of the Action
show/hide Instances
MonadState st (Action pkt st)
Monad (Action pkt st)
MonadIO (Action pkt st)
data AcceptResult pkt st Source
The type of result of the Acceptor
Constructors
Refuse
Parallel (st -> st)
Interrupt (Action pkt st ())
Actions
module Control.Hasim.Action
SimRun
runSimulation :: Simulation -> IO ()Source
Run the simulation.
Produced by Haddock version 2.3.0