monad-par-extras-0.3.3: Combinators and extra features for Par monads
Safe HaskellSafe-Inferred
LanguageHaskell98

Control.Monad.Par.RNG

Description

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.

Synopsis

Documentation

class ParRand (p :: Type -> Type) where Source #

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

Minimal complete definition

rand

Methods

rand :: Random a => p a Source #

randInt :: p Int Source #

Instances

Instances details
(ParFuture fut p, RandomGen g) => ParRand (StateT g p) Source #

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

Instance details

Defined in Control.Monad.Par.RNG

Methods

rand :: Random a => StateT g p a Source #

randInt :: StateT g p Int Source #

runParRand :: forall (fut :: Type -> Type) p a. ParFuture fut p => (p a -> a) -> StateT StdGen p a -> IO a Source #

type ParRandStd (par :: Type -> Type) a = StateT StdGen par a Source #

A convenience type for the most standard

Orphan instances

RandomGen g => SplittableState g Source #

Trivial instance.

Instance details

Methods

splitState :: g -> (g, g) Source #