[Haskell-cafe] rand* why not of type State g a

Henning Thielemann lemming at henning-thielemann.de
Sat Aug 19 18:32:05 EDT 2006


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


More information about the Haskell-Cafe mailing list