knit-haskell-0.5.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 RandomFu m r Source #

Random Effect

Actions

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

Convert a random-fu RVar to the Random Effect

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

Convert a random-fu Distribution to the Random Effect

Interpretations

runRandomFuIOSimple :: forall effs a. MonadIO (Sem effs) => Sem (RandomFu ': effs) a -> Sem effs a Source #

Run in IO using default random-fu IO source

runRandomFuIOPureMT :: MonadIO (Sem effs) => PureMT -> Sem (RandomFu ': effs) a -> Sem effs a Source #

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

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

Run using the given source

Interop

absorbMonadRandom :: Member RandomFu r => (forall m. MonadRandom m => m a) -> Sem r a Source #

Given a function that uses the random-fu package and produces a result thusly constrained by MonadRandom, absorb it into a Polysemy monad whose effect list contains the RandomFu effect.

Deprecated, will be removed in next release

type Random = RandomFu Source #

Deprecated: Use RandomFu instead