I&#39;m wondering how you gonna `append&#39; two state ?<br><br><div class="gmail_quote">On Sat, Aug 6, 2011 at 6:14 PM, Tim Cowlishaw <span dir="ltr">&lt;<a href="mailto:tim@timcowlishaw.co.uk">tim@timcowlishaw.co.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi there all,<br>
<br>
I&#39;ve come up with the following sketch for a simple agent-based<br>
simulation program in Haskell. However, I&#39;d be interested in knowing<br>
whether there are any obvious instances of more general typeclasses<br>
hidden in there that I haven&#39;t recognised!<br>
<br>
<a href="https://gist.github.com/1129216" target="_blank">https://gist.github.com/1129216</a><br>
<br>
Some explanation: A simulation is comprised of a starting state, and a<br>
set of agents which take in a state and output an updated state. The<br>
particular simulation I&#39;m working on has very specific timing<br>
semantics in that, for each &#39;step&#39; of the simulation, all the agents<br>
must see the same state (so they cannot simply be composed and applied<br>
sequentially), and the resulting states must be applied to create the<br>
next state in a well-defined order (hence the monoid restriction on<br>
the SimState type). For this reason, I&#39;m having trouble coming up with<br>
a monad instance (which would seem to me to imply that the &#39;agent&#39;<br>
functions would be applied sequentially). However, are there any other<br>
more general typeclasses that might offer useful abstractions in this<br>
case?<br>
<br>
In addition, the &#39;building up&#39; of a simulation from an initial state<br>
also looks to me like an anamorphism of some kind - is this correct?<br>
<br>
Many thanks,<br>
<br>
Tim<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.yi-programmer.com/blog/">http://www.yi-programmer.com/blog/</a><br>