monad-bayes-0.1.0.0: A library for probabilistic programming.

Copyright(c) Adam Scibior 2015-2020
LicenseMIT
Maintainerleonhard.markert@tweag.io
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Bayes.Free

Description

FreeSampler is a free monad transformer over random sampling.

Synopsis

Documentation

data FreeSampler m a Source #

Free monad transformer over random sampling.

Instances
MonadTrans FreeSampler Source # 
Instance details

Defined in Control.Monad.Bayes.Free

Methods

lift :: Monad m => m a -> FreeSampler m a #

Monad (FreeSampler m) Source # 
Instance details

Defined in Control.Monad.Bayes.Free

Methods

(>>=) :: FreeSampler m a -> (a -> FreeSampler m b) -> FreeSampler m b #

(>>) :: FreeSampler m a -> FreeSampler m b -> FreeSampler m b #

return :: a -> FreeSampler m a #

fail :: String -> FreeSampler m a #

Functor (FreeSampler m) Source # 
Instance details

Defined in Control.Monad.Bayes.Free

Methods

fmap :: (a -> b) -> FreeSampler m a -> FreeSampler m b #

(<$) :: a -> FreeSampler m b -> FreeSampler m a #

Applicative (FreeSampler m) Source # 
Instance details

Defined in Control.Monad.Bayes.Free

Methods

pure :: a -> FreeSampler m a #

(<*>) :: FreeSampler m (a -> b) -> FreeSampler m a -> FreeSampler m b #

liftA2 :: (a -> b -> c) -> FreeSampler m a -> FreeSampler m b -> FreeSampler m c #

(*>) :: FreeSampler m a -> FreeSampler m b -> FreeSampler m b #

(<*) :: FreeSampler m a -> FreeSampler m b -> FreeSampler m a #

Monad m => MonadSample (FreeSampler m) Source # 
Instance details

Defined in Control.Monad.Bayes.Free

hoist :: (Monad m, Monad n) => (forall x. m x -> n x) -> FreeSampler m a -> FreeSampler n a Source #

Hoist FreeSampler through a monad transform.

interpret :: MonadSample m => FreeSampler m a -> m a Source #

Execute random sampling in the transformed monad.

withRandomness :: Monad m => [Double] -> FreeSampler m a -> m a Source #

Execute computation with supplied values for random choices.

withPartialRandomness :: MonadSample m => [Double] -> FreeSampler m a -> m (a, [Double]) Source #

Execute computation with supplied values for a subset of random choices. Return the output value and a record of all random choices used, whether taken as input or drawn using the transformed monad.

runWith :: MonadSample m => [Double] -> FreeSampler Identity a -> m (a, [Double]) Source #

Like withPartialRandomness, but use an arbitrary sampling monad.