polysemy-zoo-0.7.0.2: Experimental, user-contributed effects and interpreters for polysemy
Safe HaskellNone
LanguageHaskell2010

Polysemy.Random

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

Instances details
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 x. (MemberWithError Random r, Random x) => Sem r x Source #

randomR :: forall r x. (MemberWithError Random r, Random x) => (x, x) -> Sem r x 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 (Embed IO) r => Sem (Random ': r) a -> Sem r a Source #

Run a Random effect by using the IO random generator.