probability-0.2.4.1: Probabilistic Functional Programming

Safe HaskellSafe-Inferred

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 compose but with intermediate duplicate elimination.

untilLeft :: (Num prob, Ord a, Ord b) => (a -> T prob (Either b a)) -> T prob a -> T prob bSource

fix :: (Num prob, Ord a, Ord b) => ((a -> EitherT a (T prob) b) -> a -> EitherT a (T prob) b) -> T prob a -> T prob bSource

In fix $ go a -> do ...; go xy any action after a go is ignored.

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