knit-haskell-0.1.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 -> Semantic effs t Source #

Convert a random-fu RVar to the Random Effect

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

Convert a random-fu Distribution to the Random Effect

Interpretations

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

Run in IO using default random-fu IO source

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

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

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

Run using the given source

Orphan instances

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

supply instance of MonadRandom for functions which require it

Instance details