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

Language.Kuifje.Distribution

Synopsis

# Documentation

type Prob = Rational Source #

Type synonym for probabilities.

newtype Dist a Source #

Distribution data type.

Constructors

 D FieldsrunD :: Map a Prob
Instances
 Ord a => Eq (Dist a) Source # Instance detailsDefined in Language.Kuifje.Distribution Methods(==) :: Dist a -> Dist a -> Bool #(/=) :: Dist a -> Dist a -> Bool # Ord a => Ord (Dist a) Source # Instance detailsDefined in Language.Kuifje.Distribution Methodscompare :: 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 detailsDefined in Language.Kuifje.PrettyPrint MethodsshowsPrec :: Int -> Dist a -> ShowS #show :: Dist a -> String #showList :: [Dist a] -> ShowS # (Boxable a, Ord a) => Boxable (Dist a) Source # Instance detailsDefined in Language.Kuifje.PrettyPrint MethodstoBox :: Dist a -> Box Source #

type Hyper a = Dist (Dist a) Source #

Type alias for hyper-distributions.

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.

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

Alias for return function.

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

Top-level bind function for distributions.

join :: Ord a => Hyper 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.