Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Deterministic and probabilistic generators
Synopsis
- type Change a = a -> a
- type T prob a = a -> T prob a
- id :: Num prob => T prob a
- map :: (Num prob, Ord a) => Change a -> T prob a -> T prob a
- unfold :: (Num prob, Ord a) => T prob (T prob a) -> T prob a
- compose :: (Num prob, Ord a) => [T prob a] -> T prob a
- untilLeft :: (Num prob, Ord a, Ord b) => (a -> T prob (Either b a)) -> T prob a -> T prob b
- fix :: (Num prob, Ord a, Ord b) => ((a -> EitherT a (T prob) b) -> a -> EitherT a (T prob) b) -> T prob a -> T prob b
- type SpreadC prob a = [Change a] -> T prob a
- apply :: Num prob => Change a -> T prob a
- maybe :: Num prob => prob -> Change a -> T prob a
- lift :: Spread prob a -> SpreadC prob a
- uniform :: Fractional prob => SpreadC prob a
- linear :: Fractional prob => SpreadC prob a
- normal :: Floating prob => SpreadC prob a
- enum :: RealFloat prob => [Int] -> SpreadC prob a
- relative :: RealFloat prob => [prob] -> SpreadC prob a
- type SpreadT prob a = [T prob a] -> T prob a
- liftT :: (Num prob, Ord a) => Spread prob (T prob a) -> SpreadT prob a
- uniformT :: (Fractional prob, Ord a) => SpreadT prob a
- linearT :: (Fractional prob, Ord a) => SpreadT prob a
- normalT :: (Floating prob, Ord a) => SpreadT prob a
- enumT :: (RealFloat prob, Ord a) => [Int] -> SpreadT prob a
- relativeT :: (RealFloat prob, Ord a) => [prob] -> SpreadT prob a
Transitions
unfold :: (Num prob, Ord a) => T prob (T prob a) -> T prob a Source #
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 a Source #
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 b Source #
fix :: (Num prob, Ord a, Ord b) => ((a -> EitherT a (T prob) b) -> a -> EitherT a (T prob) b) -> T prob a -> T prob b Source #
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 a Source #
functions to convert a list of changes into a transition
uniform :: Fractional prob => SpreadC prob a Source #
linear :: Fractional prob => SpreadC prob a Source #