
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.