MonadRandomLazy-0.1: Lazy monad for psuedo random-number generation.

Portabilitynon-portable (multi-parameter type classes, undecidable instances)
Safe HaskellSafe-Inferred



License : BSD3

A lazy monad for random-number generation. This monad allows, for example, computation of infinite random lists.

This monad respects the interface defined by MonadRandom.

A monadic computation is one that consumes random values. The bind operation works like the Gen monad in QuickCheck: it does not thread the random seed; instead it *splits* the random seed.



evalRand :: RandomGen g => Rand g a -> g -> aSource

Evaluate a random computation using the generator g. The new g is discarded.

runRand :: RandomGen g => Rand g a -> g -> (a, g)Source

Run a random computation using the generator g, returning the result and a new generator.

evalRandIO :: Rand StdGen a -> IO aSource

Evaluate a random computation in the IO monad, using the random number generator supplied by getStdRandom.

data Rand g a Source


(Monad (Rand g), RandomGen g) => MonadSplit g (Rand g) 
RandomGen g => Monad (Rand g) 
Functor (Rand g)

A value of type 'Rand g a' is a monadic computation which, when run, consumes random values from an applicative random-number generator of type g and produces a result of type a.

(Functor (Rand g), RandomGen g) => Applicative (Rand g) 
(Monad (Rand g), RandomGen g) => MonadRandom (Rand g)