[Haskell-beginners] MonadRandom or Control.Monad.Random

Brent Yorgey byorgey at seas.upenn.edu
Fri Jul 31 21:02:02 EDT 2009


On Fri, Jul 31, 2009 at 05:55:43PM -0700, Michael P Mossey wrote:
> Brent Yorgey wrote:
>> On Thu, Jul 30, 2009 at 05:04:54PM -0700, Michael P Mossey wrote:
>>> Where can I find MonadRandom or Control.Monad.Random to install? It 
>>> doesn't seem to be a system library, I can't find it with cabal or 
>>> Hoogle.
>>
>> 'cabal install MonadRandom' ought to work.  Note that you may have to
>> 'cabal update' first to make sure cabal has the most up-to-date
>> package list.  You can also always look at the complete list of
>> packages on Hackage by going to hackage.haskell.org.
>>
>> -Brent
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>
> That worked.
>
> I'm looking at this example from the docs. I understand most of this but I 
> can't find a definition of getRandomR. See die has type (Rand g Int) I'm 
> assuming getRandomR is a function that has that type, but I can't find its 
> definition.

getRandomR has type 

  (MonadRandom m, Random a) => (a, a) -> m a

which in particular can be specialized to 

  (RandomGen g) => (Int,Int) -> Rand g Int . 

The documentation for getRandomR, and the other methods of the
MonadRandom class, can be found here:

  http://hackage.haskell.org/packages/archive/MonadRandom/0.1.3/doc/html/Control-Monad-Random-Class.html

-Brent


More information about the Beginners mailing list