probability-0.2.2: Probabilistic Functional Programming

Numeric.Probability.Transition

Contents

Description

Deterministic and probabilistic generators

Synopsis

Transitions

type Change a = a -> aSource

deterministic generator

type T prob a = a -> T prob aSource

probabilistic generator

id :: Num prob => T prob aSource

map :: (Num prob, Ord a) => Change a -> T prob a -> T prob aSource

map maps a change function to the result of a transformation (map is somehow a lifted form of map) The restricted type of f results from the fact that the argument to t cannot be changed to b in the result T type.

unfold :: (Num prob, Ord a) => T prob (T prob a) -> T prob aSource

unfold a distribution of transitions into one transition

NOTE: The argument transitions must be independent

compose :: (Num prob, Ord a) => [T prob a] -> T prob aSource

Composition of transitions similar to Numeric.Probability.Monad.compose but with intermediate duplicate elimination.

Spreading changes into transitions

type SpreadC prob a = [Change a] -> T prob aSource

functions to convert a list of changes into a transition

apply :: Num prob => Change a -> T prob aSource

maybe :: Num prob => prob -> Change a -> T prob aSource

lift :: Spread prob a -> SpreadC prob aSource

uniform :: Fractional prob => SpreadC prob aSource

linear :: Fractional prob => SpreadC prob aSource

normal :: Floating prob => SpreadC prob aSource

enum :: RealFloat prob => [Int] -> SpreadC prob aSource

relative :: RealFloat prob => [prob] -> SpreadC prob aSource

Spreading transitions into transitions

type SpreadT prob a = [T prob a] -> T prob aSource

functions to convert a list of transitions into a transition

liftT :: (Num prob, Ord a) => Spread prob (T prob a) -> SpreadT prob aSource

uniformT :: (Fractional prob, Ord a) => SpreadT prob aSource

linearT :: (Fractional prob, Ord a) => SpreadT prob aSource

normalT :: (Floating prob, Ord a) => SpreadT prob aSource

enumT :: (RealFloat prob, Ord a) => [Int] -> SpreadT prob aSource

relativeT :: (RealFloat prob, Ord a) => [prob] -> SpreadT prob aSource