On Sun, Aug 20, 2006 at 12:32:05AM +0200, Henning Thielemann wrote: > > On Sun, 13 Aug 2006, Marc Weber wrote: > > > the rand* function are examples for a typical state usage, arent' they? > > Is there any reasoon why they are not defined > > RandomGen g => State g a > > rather than > > RandomGen g => (a,a) -> g -> (a,g) > > ? > > It's probably because Control.Monad.State belongs to the MTL which is > outside Prelude. Nonetheless I find it also more convenient to use the > State monad for random number generators: > http://darcs.haskell.org/htam/src/Stochastic.hs > http://www.haskell.org/pipermail/haskell-cafe/2005-May/009775.html
Exactly, and thanks to the right order of parameters and the result pair, you can easily use random* functions in a State monad: do x <- State random y <- State (randomR (0, 100)) ... Best regards Tomasz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe