[Haskell-cafe] Multi agent system

Yves Parès limestrael at gmail.com
Sat Apr 2 13:16:23 CEST 2011


Hello,

For the purpose of a simple game, I'm looking for a simple way to get agents
communicating with each other, with agents possibly running on different
threads:

Basically, an agent is Agent :: * -> *, since it is parameterized with the
type of messages it can receive, and can make two basic operations:
fetch, which gives it the messages in its mailbox
and send, which sends a message a to an Agent a

Given that haskell threads are lightweight, is it reasonable to lauch a
thread per agent and then implement fetch and send through Chans?
It will be simple to implement and to use, but if I have, say, two hundreds
of really dumb (sorry, *reactive *^^) agents, like ants, I will have to
launch as many threads.

I could use a neater abstraction than IO to model agents (FRP is perfect for
that), but I would loose the benefits of concurrent programming (or I won't
be able to keep things simple).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110402/2355d052/attachment.htm>


More information about the Haskell-Cafe mailing list