kuifje-0.1.1.0: A Quantitative Information Flow aware programming language.

Safe HaskellSafe
LanguageHaskell2010

Language.Kuifje.Distribution

Synopsis

Documentation

type Prob = Rational Source #

Type synonym for probabilities.

newtype Dist a Source #

Distribution data type.

Constructors

D 

Fields

Instances
Ord a => Eq (Dist a) Source # 
Instance details

Defined in Language.Kuifje.Distribution

Methods

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

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

Ord a => Ord (Dist a) Source # 
Instance details

Defined in Language.Kuifje.Distribution

Methods

compare :: Dist a -> Dist a -> Ordering #

(<) :: Dist a -> Dist a -> Bool #

(<=) :: Dist a -> Dist a -> Bool #

(>) :: Dist a -> Dist a -> Bool #

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

max :: Dist a -> Dist a -> Dist a #

min :: Dist a -> Dist a -> Dist a #

(Ord a, Boxable a) => Show (Dist a) Source # 
Instance details

Defined in Language.Kuifje.PrettyPrint

Methods

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

show :: Dist a -> String #

showList :: [Dist a] -> ShowS #

(Boxable a, Ord a) => Boxable (Dist a) Source # 
Instance details

Defined in Language.Kuifje.PrettyPrint

Methods

toBox :: Dist a -> Box Source #

fmap :: Ord b => (a -> b) -> Dist a -> Dist b Source #

Top-level fmap function for distributions.

return :: Ord a => a -> Dist a Source #

Top-level return function for distributions. Creates a singleton distribution.

(>>=) :: Ord b => Dist a -> (a -> Dist b) -> Dist b Source #

Top-level bind function for distributions.

join :: Ord a => Dist (Dist a) -> Dist a Source #

Top-level join function for distributions.

uniform :: Ord a => [a] -> Dist a Source #

Construct a discrete distribution from a nonempty list of elements, assigning the same probability to each element.

choose :: Ord a => Prob -> a -> a -> Dist a Source #

Construct a distribution in which the first element has probability p and the second 1−p.

unpackD :: Dist a -> Map a Prob Source #

Recover the map representation of a distribution, reduced.

reduction :: Dist a -> Dist a Source #

Remove zeroes from a distribution.

weight :: Dist a -> Prob Source #

Sum the probabilities in the distribution.