
17 May
2013
17 May
'13
1:51 p.m.
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.