knit-haskell-0.2.0.0: a minimal Rmarkdown sort-of-thing for haskell, by way of Pandoc

Copyright(c) Adam Conner-Sax 2019
LicenseBSD-3-Clause
Maintaineradam_conner_sax@yahoo.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Knit.Effect.RandomFu

Contents

Description

Polysemy "random-fu" effect. Allows a polysemy "stack" to satisfy a MonadRandom (from "random-fu") constraint. This can be run in a few ways:

  1. Directly in IO
  2. Using any RandomSource from "random-fu"
  3. In IO, using a given PureMT source. (IO is used to put the source in an IORef)
Synopsis

Effect

data Random m r Source #

Random Effect

Actions

sampleRVar :: Member Random effs => RVar t -> Sem effs t Source #

Convert a random-fu RVar to the Random Effect

sampleDist :: (Member Random effs, Distribution d t) => d t -> Sem effs t Source #

Convert a random-fu Distribution to the Random Effect

Interpretations

runRandomIOSimple :: forall effs a. MonadIO (Sem effs) => Sem (Random ': effs) a -> Sem effs a Source #

Run in IO using default random-fu IO source

runRandomIOPureMT :: MonadIO (Sem effs) => PureMT -> Sem (Random ': effs) a -> Sem effs a Source #

Run in IO, using the given PureMT source stored in an IORef

runRandomFromSource :: forall s effs a. RandomSource (Sem effs) s => s -> Sem (Random ': effs) a -> Sem effs a Source #

Run using the given source

Orphan instances

Member (Random :: (Type -> Type) -> Type -> Type) effs => MonadRandom (Sem effs) Source #

supply instance of MonadRandom for functions which require it

Instance details