polysemy-zoo-0.2.0.0: Experimental, user-contributed effects and interpreters for polysemy

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 r a. (Member Random r, Random a) => Sem r a Source #

randomR :: forall r a. (Member Random r, Random a) => (a, a) -> Sem r a Source #

Interpretations

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

Run a Random effect with an explicit RandomGen.

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

Run a Random effect by using the IO random generator.