17 May 2013 19:51
Fish tank monad
Adrian May <adrian.alexander.may <at> gmail.com>
2013-05-17 17:51:11 GMT
2013-05-17 17:51:11 GMT
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.
<div><div dir="ltr">Hi folks,<div><br></div> <div>I think I need a monad but I'm not sure which, and maybe something simpler would do.</div> <div><br></div> <div>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.</div> <div><br></div> <div>This seems like the kind of thing that would be in the prelude somewhere. But where?</div> <div><br></div> <div>TIA,</div> <div>Adrian.</div> <div><br></div> <div><br></div> </div></div>
RSS Feed