monad-bayes-1.3.0.1: A library for probabilistic programming.
Copyright(c) Adam Scibior 2015-2020
LicenseMIT
Maintainerleonhard.markert@tweag.io
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Bayes.Sampler.Strict

Description

SamplerIO and SamplerST are instances of MonadDistribution. Apply a MonadFactor transformer to obtain a MonadMeasure that can execute probabilistic models.

Synopsis

Documentation

newtype SamplerT g m a Source #

The sampling interpretation of a probabilistic program Here m is typically IO or ST

Constructors

SamplerT 

Fields

Instances

Instances details
MonadTrans (SamplerT g) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

Methods

lift :: Monad m => m a -> SamplerT g m a #

MonadIO m => MonadIO (SamplerT g m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

Methods

liftIO :: IO a -> SamplerT g m a #

Applicative m => Applicative (SamplerT g m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

Methods

pure :: a -> SamplerT g m a #

(<*>) :: SamplerT g m (a -> b) -> SamplerT g m a -> SamplerT g m b #

liftA2 :: (a -> b -> c) -> SamplerT g m a -> SamplerT g m b -> SamplerT g m c #

(*>) :: SamplerT g m a -> SamplerT g m b -> SamplerT g m b #

(<*) :: SamplerT g m a -> SamplerT g m b -> SamplerT g m a #

Functor m => Functor (SamplerT g m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

Methods

fmap :: (a -> b) -> SamplerT g m a -> SamplerT g m b #

(<$) :: a -> SamplerT g m b -> SamplerT g m a #

Monad m => Monad (SamplerT g m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

Methods

(>>=) :: SamplerT g m a -> (a -> SamplerT g m b) -> SamplerT g m b #

(>>) :: SamplerT g m a -> SamplerT g m b -> SamplerT g m b #

return :: a -> SamplerT g m a #

StatefulGen g m => MonadDistribution (SamplerT g m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sampler.Strict

type SamplerIO = SamplerT (IOGenM StdGen) IO Source #

convenient type synonym to show specializations of SamplerT to particular pairs of monad and RNG

type SamplerST s = SamplerT (STGenM StdGen s) (ST s) Source #

convenient type synonym to show specializations of SamplerT to particular pairs of monad and RNG

sampleIO :: SamplerIO a -> IO a Source #

initialize random seed using system entropy, and sample

sampleIOfixed :: SamplerIO a -> IO a Source #

Run the sampler with a fixed random seed

sampleWith :: SamplerT g m a -> g -> m a Source #

Sample with a random number generator of your choice e.g. the one from Random.

>>> import Control.Monad.Bayes.Class
>>> import System.Random.Stateful hiding (random)
>>> newIOGenM (mkStdGen 1729) >>= sampleWith random
4.690861245089605e-2

sampleSTfixed :: SamplerST s b -> ST s b Source #

Run the sampler with a fixed random seed

sampler :: SamplerIO a -> IO a Source #

initialize random seed using system entropy, and sample