
I'm wondering how you gonna `append' two state ?
On Sat, Aug 6, 2011 at 6:14 PM, Tim Cowlishaw
Hi there all,
I've come up with the following sketch for a simple agent-based simulation program in Haskell. However, I'd be interested in knowing whether there are any obvious instances of more general typeclasses hidden in there that I haven't recognised!
https://gist.github.com/1129216
Some explanation: A simulation is comprised of a starting state, and a set of agents which take in a state and output an updated state. The particular simulation I'm working on has very specific timing semantics in that, for each 'step' of the simulation, all the agents must see the same state (so they cannot simply be composed and applied sequentially), and the resulting states must be applied to create the next state in a well-defined order (hence the monoid restriction on the SimState type). For this reason, I'm having trouble coming up with a monad instance (which would seem to me to imply that the 'agent' functions would be applied sequentially). However, are there any other more general typeclasses that might offer useful abstractions in this case?
In addition, the 'building up' of a simulation from an initial state also looks to me like an anamorphism of some kind - is this correct?
Many thanks,
Tim
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners