module Data.Random.Distribution.Hypergeometric
( Hypergeometric
, hypergeometric
, getM, getL, getK
, hypergeometricVar
, hypergeometricVarT
) where
import Data.Random.RVar
import Data.Random.Distribution
import Data.Random.Distribution.Uniform
import Data.Random.Distribution.Hypergeometric.Impl
data Hypergeometric t = Hypergeometric { getK :: !t, getL :: !t, getM :: !t }
hypergeometric :: (Num a, Ord a) => a -> a -> a -> Hypergeometric a
hypergeometric k l m
| l < 0 = error "l must not be negative"
| m < 0 || m > l = error "m must be in [0,l]"
| k < 0 || k > l = error "k must be in [0,l]"
| otherwise = Hypergeometric k l m
hypergeometricVar :: (Num a, Ord a, Distribution Hypergeometric a) => a -> a -> a -> RVar a
hypergeometricVar = hypergeometricVarT
hypergeometricVarT :: (Num a, Ord a, Distribution Hypergeometric a) => a -> a -> a -> RVarT m a
hypergeometricVarT k l m = rvarT (hypergeometric k l m)
instance (Integral t) => Distribution Hypergeometric t where
rvarT (Hypergeometric k l m) = rhyper (k, l, m)