monad-bayes-1.3.0.3: 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.Sequential.Coroutine

Description

SequentialT represents a computation that can be suspended.

Synopsis

Documentation

data SequentialT m a Source #

Represents a computation that can be suspended at certain points. The intermediate monadic effects can be extracted, which is particularly useful for implementation of Sequential Monte Carlo related methods. All the probabilistic effects are lifted from the transformed monad, but also suspend is inserted after each factor.

Instances

Instances details
MonadTrans SequentialT Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

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

MonadIO m => MonadIO (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

liftIO :: IO a -> SequentialT m a #

Monad m => Applicative (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

pure :: a -> SequentialT m a #

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

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

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

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

Functor m => Functor (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

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

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

Monad m => Monad (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

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

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

return :: a -> SequentialT m a #

MonadDistribution m => MonadDistribution (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

MonadFactor m => MonadFactor (SequentialT m) Source #

Execution is suspended after each score.

Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

Methods

score :: Log Double -> SequentialT m () Source #

MonadMeasure m => MonadMeasure (SequentialT m) Source # 
Instance details

Defined in Control.Monad.Bayes.Sequential.Coroutine

suspend :: Monad m => SequentialT m () Source #

A point where the computation is paused.

finish :: Monad m => SequentialT m a -> m a Source #

Remove the remaining suspension points.

advance :: Monad m => SequentialT m a -> SequentialT m a Source #

Execute to the next suspension point. If the computation is finished, do nothing.

finish = finish . advance

finished :: Monad m => SequentialT m a -> m Bool Source #

Return True if no more suspension points remain.

hoistFirst :: (forall x. m x -> m x) -> SequentialT m a -> SequentialT m a Source #

Transform the inner monad. This operation only applies to computation up to the first suspension.

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

Transform the inner monad. The transformation is applied recursively through all the suspension points.

sequentially Source #

Arguments

:: Monad m 
=> (forall x. m x -> m x)

transformation

-> Int

number of time steps

-> SequentialT m a 
-> m a 

Sequential importance sampling. Applies a given transformation after each time step.

sis Source #

Arguments

:: Monad m 
=> (forall x. m x -> m x)

transformation

-> Int

number of time steps

-> SequentialT m a 
-> m a 

synonym

Sequential importance sampling. Applies a given transformation after each time step.