monad-par-extras-0.3.3: Combinators and extra features for Par monads

Safe HaskellSafe-Inferred



This module defines another Par-related class to capture the random number generation capability.

The rand operation provides deterministic parallel random number generation from within a Par monad.

Most likely one will simply use the ParRand the instance provided in this file, which is based on a state transformer carrying the random generator.



class ParRand p whereSource

A ParRand monad is a Par monad with support for random number generation..


rand :: Random a => p aSource

randInt :: p IntSource


(ParFuture fut p, RandomGen g) => ParRand (StateT g p)

The most straightforward way to get a ParRand monad: carry a RNG in a state transformer.

runParRand :: ParFuture fut p => (p a -> a) -> StateT StdGen p a -> IO aSource

type ParRandStd par a = StateT StdGen par aSource

A convenience type for the most standard