
hi,
yes i know about that, but i was talking about randomIO which breaks that view;
and i find that quite weird for a 'clean' language.
* another thing i remember now :
binary io. there are some libraries but it's not really standard. and
it's weird to learn all (well, or just one) that libraries just to do
io.
cheers,
mt
2006/6/15, Henning Thielemann
On Thu, 15 Jun 2006, minh thu wrote:
* randomIO side-effect is nicely resolved with monad. and you have to thread your state. if you're writing your monad or use a transformer, things are quite explicitly (even if it's implicit in the do notation) threaded.
You know that random generators are not bounded to IO? 'random' and related functions work just like the random generators in object oriented designs. In OO languages the random generator is usually an object which hides a state and there can be several instances of random generators. In Haskell the random generator can be viewed as a State monad. But you are right, you have to carry the monad with you all the time. Alternatively it is sometimes simpler to consume values from a list generated by randomRs.