| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Data.Result
Describing Simulation Results with Type Annotations
Carbon simulations are built up from MonteCarlo actions.
A MonteCarlo action describes how to arrive at an observation, but not how to aggregate observations.
This functionality is specified with a type annotation telling Haskell which instance of the type family Result should be used.
For example, given a MonteCarlo action, mySim, with type:
mySim :: RandomGen g => MonteCarlo g Bool
We get different results based on the instance of Result chosen:
experimentS mySimulation 100 g :: [Bool] experimentS mySimulation 100 g :: BoolSumm
Result is the type family used to describe the aggregation techniques to be used in a Monte Carlo simulation.
Instances of Result should specify the type of a single observation and how to include one.
The value of a Result without any observations should be specified.
Additionally, Results should be joinable.
Note that almost all instances of Result will be monoidal.