[Haskell-beginners] Fish tank monad

Adrian May adrian.alexander.may at gmail.com
Fri May 17 19:51:11 CEST 2013


Hi folks,

I think I need a monad but I'm not sure which, and maybe something simpler
would do.

I want to model a fish tank as a function of time onto how many fish there
are in it at that time. If I already have such a function, I want to
operate on it with something like "add 2 fish on day 20" or "take 3 away on
day 15" to get a new function of the same form, but the latter should not
remove more fish than there are in the tank at that time, and it should
tell me how many I get. I don't promise to apply these operators in
chronological order.

This seems like the kind of thing that would be in the prelude somewhere.
But where?

TIA,
Adrian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130518/33e25e5f/attachment.htm>


More information about the Beginners mailing list