markov-realization-0.3.0: Realizations of Markov chains.

Maintaineratloomis@math.arizona.edu
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Markov

Contents

Description

Three type classes for deterministically analyzing Markov chains with known parameters. Markov0 is intended to list possible outcomes, Markov should allow for more sophisticated analysis. See Examples for examples. See README for a detailed description.

Synopsis

Markov0

class Eq m => Markov0 m where Source #

A basic implementation of Markov chains.

Minimal complete definition

transition0 | step0

Methods

transition0 :: m -> [m -> m] Source #

step0 :: m -> [m] Source #

Instances
Markov0 Simple Source # 
Instance details

Defined in Markov.Example

chain0 :: Markov0 m => [m] -> [[m]] Source #

Itterated steps, with equal states combined.

Markov

class (Applicative t, Comonad t) => Markov t m where Source #

An implementation of Markov chains.

Minimal complete definition

transition | step | sequential

Methods

transition :: m -> [t (m -> m)] Source #

step :: t m -> [t m] Source #

sequential :: [m -> [t (m -> m)]] Source #

Instances
Markov ((,) (Product Rational, Merge String)) Room Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Sum Int, Product Rational)) Extinction Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) FillBin Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Tidal Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Urn Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Simple Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) FromLists Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Int)) Simple Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Sum Int)) Simple Source # 
Instance details

Defined in Markov.Example

chain :: (Combine (t m), Grouping (t m), Markov t m) => [t m] -> [[t m]] Source #

Iterated steps, with equal states combined using summarize operation. WARNING: group does not currently respect equivalence classes, only Grouping.

Combine

class Combine a where Source #

Within equivalence classes, combine should be associative, commutative, and should be idempotent up to equivalence. I.e. if x == y == z,

(x `combine` y) `combine` z = x `combine` (y `combine` z)
x `combine` y = y `combine` x
x `combine` x == x

Minimal complete definition

combine | summarize

Methods

combine :: a -> a -> a Source #

summarize :: NonEmpty a -> a Source #

Instances
Combine FillBin Source # 
Instance details

Defined in Markov.Example

Combine Room Source # 
Instance details

Defined in Markov.Example

Combine Tidal Source # 
Instance details

Defined in Markov.Example

Combine Extinction Source # 
Instance details

Defined in Markov.Example

Combine Urn Source # 
Instance details

Defined in Markov.Example

Combine Simple Source # 
Instance details

Defined in Markov.Example

Combine FromLists Source # 
Instance details

Defined in Markov.Example

Num a => Combine (Product a) Source # 
Instance details

Defined in Markov

Combine (Sum a) Source # 
Instance details

Defined in Markov

Methods

combine :: Sum a -> Sum a -> Sum a Source #

summarize :: NonEmpty (Sum a) -> Sum a Source #

Combine (Merge a) Source # 
Instance details

Defined in Markov

Methods

combine :: Merge a -> Merge a -> Merge a Source #

summarize :: NonEmpty (Merge a) -> Merge a Source #

(Combine a, Combine b) => Combine (a, b) Source # 
Instance details

Defined in Markov

Methods

combine :: (a, b) -> (a, b) -> (a, b) Source #

summarize :: NonEmpty (a, b) -> (a, b) Source #

(Combine a, Combine b, Combine c) => Combine (a, b, c) Source # 
Instance details

Defined in Markov

Methods

combine :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #

summarize :: NonEmpty (a, b, c) -> (a, b, c) Source #

newtype Merge a Source #

Values from a Monoid which have the respective binary operation applied each step, where different values mean states should not be combined. E.g., strings with concatenation.

Constructors

Merge a 
Instances
Enum a => Enum (Merge a) Source # 
Instance details

Defined in Markov

Methods

succ :: Merge a -> Merge a #

pred :: Merge a -> Merge a #

toEnum :: Int -> Merge a #

fromEnum :: Merge a -> Int #

enumFrom :: Merge a -> [Merge a] #

enumFromThen :: Merge a -> Merge a -> [Merge a] #

enumFromTo :: Merge a -> Merge a -> [Merge a] #

enumFromThenTo :: Merge a -> Merge a -> Merge a -> [Merge a] #

Eq a => Eq (Merge a) Source # 
Instance details

Defined in Markov

Methods

(==) :: Merge a -> Merge a -> Bool #

(/=) :: Merge a -> Merge a -> Bool #

Fractional a => Fractional (Merge a) Source # 
Instance details

Defined in Markov

Methods

(/) :: Merge a -> Merge a -> Merge a #

recip :: Merge a -> Merge a #

fromRational :: Rational -> Merge a #

Num a => Num (Merge a) Source # 
Instance details

Defined in Markov

Methods

(+) :: Merge a -> Merge a -> Merge a #

(-) :: Merge a -> Merge a -> Merge a #

(*) :: Merge a -> Merge a -> Merge a #

negate :: Merge a -> Merge a #

abs :: Merge a -> Merge a #

signum :: Merge a -> Merge a #

fromInteger :: Integer -> Merge a #

Show a => Show (Merge a) Source # 
Instance details

Defined in Markov

Methods

showsPrec :: Int -> Merge a -> ShowS #

show :: Merge a -> String #

showList :: [Merge a] -> ShowS #

Generic (Merge a) Source # 
Instance details

Defined in Markov

Associated Types

type Rep (Merge a) :: Type -> Type #

Methods

from :: Merge a -> Rep (Merge a) x #

to :: Rep (Merge a) x -> Merge a #

Semigroup a => Semigroup (Merge a) Source # 
Instance details

Defined in Markov

Methods

(<>) :: Merge a -> Merge a -> Merge a #

sconcat :: NonEmpty (Merge a) -> Merge a #

stimes :: Integral b => b -> Merge a -> Merge a #

Monoid a => Monoid (Merge a) Source # 
Instance details

Defined in Markov

Methods

mempty :: Merge a #

mappend :: Merge a -> Merge a -> Merge a #

mconcat :: [Merge a] -> Merge a #

Grouping a => Grouping (Merge a) Source # 
Instance details

Defined in Markov

Methods

grouping :: Group (Merge a) #

Combine (Merge a) Source # 
Instance details

Defined in Markov

Methods

combine :: Merge a -> Merge a -> Merge a Source #

summarize :: NonEmpty (Merge a) -> Merge a Source #

Markov ((,) (Product Rational, Merge String)) Room Source # 
Instance details

Defined in Markov.Example

type Rep (Merge a) Source # 
Instance details

Defined in Markov

type Rep (Merge a) = D1 (MetaData "Merge" "Markov" "markov-realization-0.3.0-5G6aaFp9qxGCG9ox1pSRBj" True) (C1 (MetaCons "Merge" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

newtype Sum a Source #

Values which are added each step where different values mean states should not be combined. E.g., number of times a red ball is picked from an urn.

Constructors

Sum a 
Instances
Enum a => Enum (Sum a) Source # 
Instance details

Defined in Markov

Methods

succ :: Sum a -> Sum a #

pred :: Sum a -> Sum a #

toEnum :: Int -> Sum a #

fromEnum :: Sum a -> Int #

enumFrom :: Sum a -> [Sum a] #

enumFromThen :: Sum a -> Sum a -> [Sum a] #

enumFromTo :: Sum a -> Sum a -> [Sum a] #

enumFromThenTo :: Sum a -> Sum a -> Sum a -> [Sum a] #

Eq a => Eq (Sum a) Source # 
Instance details

Defined in Markov

Methods

(==) :: Sum a -> Sum a -> Bool #

(/=) :: Sum a -> Sum a -> Bool #

Fractional a => Fractional (Sum a) Source # 
Instance details

Defined in Markov

Methods

(/) :: Sum a -> Sum a -> Sum a #

recip :: Sum a -> Sum a #

fromRational :: Rational -> Sum a #

Num a => Num (Sum a) Source # 
Instance details

Defined in Markov

Methods

(+) :: Sum a -> Sum a -> Sum a #

(-) :: Sum a -> Sum a -> Sum a #

(*) :: Sum a -> Sum a -> Sum a #

negate :: Sum a -> Sum a #

abs :: Sum a -> Sum a #

signum :: Sum a -> Sum a #

fromInteger :: Integer -> Sum a #

Show a => Show (Sum a) Source # 
Instance details

Defined in Markov

Methods

showsPrec :: Int -> Sum a -> ShowS #

show :: Sum a -> String #

showList :: [Sum a] -> ShowS #

Generic (Sum a) Source # 
Instance details

Defined in Markov

Associated Types

type Rep (Sum a) :: Type -> Type #

Methods

from :: Sum a -> Rep (Sum a) x #

to :: Rep (Sum a) x -> Sum a #

Num a => Semigroup (Sum a) Source # 
Instance details

Defined in Markov

Methods

(<>) :: Sum a -> Sum a -> Sum a #

sconcat :: NonEmpty (Sum a) -> Sum a #

stimes :: Integral b => b -> Sum a -> Sum a #

Num a => Monoid (Sum a) Source # 
Instance details

Defined in Markov

Methods

mempty :: Sum a #

mappend :: Sum a -> Sum a -> Sum a #

mconcat :: [Sum a] -> Sum a #

Grouping a => Grouping (Sum a) Source # 
Instance details

Defined in Markov

Methods

grouping :: Group (Sum a) #

Combine (Sum a) Source # 
Instance details

Defined in Markov

Methods

combine :: Sum a -> Sum a -> Sum a Source #

summarize :: NonEmpty (Sum a) -> Sum a Source #

Markov ((,) (Sum Int, Product Rational)) Extinction Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Sum Int)) Simple Source # 
Instance details

Defined in Markov.Example

type Rep (Sum a) Source # 
Instance details

Defined in Markov

type Rep (Sum a) = D1 (MetaData "Sum" "Markov" "markov-realization-0.3.0-5G6aaFp9qxGCG9ox1pSRBj" True) (C1 (MetaCons "Sum" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))

newtype Product a Source #

Values which are multiplied each step, and combined additively for equal states. E.g., probabilities.

Constructors

Product a 
Instances
Enum a => Enum (Product a) Source # 
Instance details

Defined in Markov

Methods

succ :: Product a -> Product a #

pred :: Product a -> Product a #

toEnum :: Int -> Product a #

fromEnum :: Product a -> Int #

enumFrom :: Product a -> [Product a] #

enumFromThen :: Product a -> Product a -> [Product a] #

enumFromTo :: Product a -> Product a -> [Product a] #

enumFromThenTo :: Product a -> Product a -> Product a -> [Product a] #

Eq (Product a) Source #

WARNING! Defined _ == _ = True!

Instance details

Defined in Markov

Methods

(==) :: Product a -> Product a -> Bool #

(/=) :: Product a -> Product a -> Bool #

Fractional a => Fractional (Product a) Source # 
Instance details

Defined in Markov

Methods

(/) :: Product a -> Product a -> Product a #

recip :: Product a -> Product a #

fromRational :: Rational -> Product a #

Num a => Num (Product a) Source # 
Instance details

Defined in Markov

Methods

(+) :: Product a -> Product a -> Product a #

(-) :: Product a -> Product a -> Product a #

(*) :: Product a -> Product a -> Product a #

negate :: Product a -> Product a #

abs :: Product a -> Product a #

signum :: Product a -> Product a #

fromInteger :: Integer -> Product a #

Show a => Show (Product a) Source # 
Instance details

Defined in Markov

Methods

showsPrec :: Int -> Product a -> ShowS #

show :: Product a -> String #

showList :: [Product a] -> ShowS #

Generic (Product a) Source # 
Instance details

Defined in Markov

Associated Types

type Rep (Product a) :: Type -> Type #

Methods

from :: Product a -> Rep (Product a) x #

to :: Rep (Product a) x -> Product a #

Num a => Semigroup (Product a) Source # 
Instance details

Defined in Markov

Methods

(<>) :: Product a -> Product a -> Product a #

sconcat :: NonEmpty (Product a) -> Product a #

stimes :: Integral b => b -> Product a -> Product a #

Num a => Monoid (Product a) Source # 
Instance details

Defined in Markov

Methods

mempty :: Product a #

mappend :: Product a -> Product a -> Product a #

mconcat :: [Product a] -> Product a #

Grouping (Product a) Source # 
Instance details

Defined in Markov

Methods

grouping :: Group (Product a) #

Num a => Combine (Product a) Source # 
Instance details

Defined in Markov

Markov ((,) (Product Rational, Merge String)) Room Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Sum Int, Product Rational)) Extinction Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) FillBin Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Tidal Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Urn Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) Simple Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Double)) FromLists Source # 
Instance details

Defined in Markov.Example

Markov ((,) (Product Int)) Simple Source # 
Instance details

Defined in Markov.Example

type Rep (Product a) Source # 
Instance details

Defined in Markov

type Rep (Product a) = D1 (MetaData "Product" "Markov" "markov-realization-0.3.0-5G6aaFp9qxGCG9ox1pSRBj" True) (C1 (MetaCons "Product" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))