Data.Probability.Base
 Portability non-portable (newtype deriving) Stability experimental
Description
Support for probability values.
Synopsis
class (Eq p, Monoid p) => Probability p where
 prob :: Rational -> p fromProb :: p -> Rational pnot :: p -> p padd :: p -> p -> p pmul :: p -> p -> p
prob :: Probability p => Rational -> p
fromProb :: Probability p => p -> Rational
pnot :: Probability p => p -> p
padd :: Probability p => p -> p -> p
pmul :: Probability p => p -> p -> p
Documentation
class (Eq p, Monoid p) => Probability p where
The probability of an event occuring. We provide this as a type class, allowing users of this library to choose among various representations of probability.
Methods
 prob :: Rational -> p Create a probability from a rational number between 0 and 1, inclusive. fromProb :: p -> Rational Convert a probability to a rational number. pnot :: p -> p Given the probability of an event occuring, calculate the probability of the event not occuring. padd :: p -> p -> p Given the probabilities of two disjoint events, calculate the probability of either event occuring. pmul :: p -> p -> p Given the probabilities of two indepedent events, calculate the probability of both events occuring.
Instances
 Probability Prob Probability Prob
prob :: Probability p => Rational -> p
Create a probability from a rational number between 0 and 1, inclusive.
fromProb :: Probability p => p -> Rational
Convert a probability to a rational number.
pnot :: Probability p => p -> p
Given the probability of an event occuring, calculate the probability of the event not occuring.
padd :: Probability p => p -> p -> p
Given the probabilities of two disjoint events, calculate the probability of either event occuring.
pmul :: Probability p => p -> p -> p
Given the probabilities of two indepedent events, calculate the probability of both events occuring.