polysemy-0.1.1.0: Higher-order, low-boilerplate, zero-cost free monads.

Safe HaskellNone
LanguageHaskell2010

Polysemy.Random

Contents

Synopsis

Effect

data Random m a where Source #

An effect capable of providing Random values.

Constructors

Random :: Random x => Random m x 
RandomR :: Random x => (x, x) -> Random m x 
Instances
type DefiningModule (Random :: k -> Type -> Type) Source # 
Instance details

Defined in Polysemy.Random

type DefiningModule (Random :: k -> Type -> Type) = "Polysemy.Random"

Actions

random :: forall x. Random x => forall r. Member Random r => Semantic r x Source #

randomR :: forall x. Random x => forall r. Member Random r => (x, x) -> Semantic r x Source #

Interpretations

runRandom :: forall q r a. (Typeable q, RandomGen q) => q -> Semantic (Random ': r) a -> Semantic r (q, a) Source #

Run a Random effect with an explicit RandomGen.

runRandomIO :: Member (Lift IO) r => Semantic (Random ': r) a -> Semantic r a Source #

Run a Random effect by using the IO random generator.