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

David Menendez zednenem at psualum.com
Sat Aug 19 19:09:07 EDT 2006


Henning Thielemann writes:

> 
> 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.

On the other hand, if you are using MTL, you'd probably want a more
general signature, like:

    (RandomGen g, MonadState g m) => m a
-- 
David Menendez <zednenem at psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"


More information about the Haskell-Cafe mailing list