measurable

A simple shallowly-embedded DSL for dealing with measures.
Log | Files | Refs | README | LICENSE

commit d8a2aaaa24130c8c7bf2a7a257dd4e4818d9f4c8
parent 5bda9e7f381bc3b13a247b9939ff05a0ab6070c8
Author: Jared Tobin <jared@jtobin.ca>
Date:   Mon, 21 Oct 2013 10:47:47 +1300

Update examples documentation.

Diffstat:
Msrc/Examples.hs | 25++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/Examples.hs b/src/Examples.hs @@ -33,6 +33,7 @@ genNormalSamples n m t g = replicateM n $ normal m (1 / t) g -- tuples. -- -- X | t ~ N(mu, 1/(lambda * t)) +-- t ~ gamma(a, b) normalGammaMeasure :: (Fractional r, PrimMonad m) => Int @@ -106,13 +107,23 @@ altNormalNormalGammaMeasure n a b mu lambda g = do main :: IO () main = do - let nng = normalNormalGammaMeasure 100 2 6 1 0.5 - m <- withSystemRandom . asGenIO $ \g -> - expectationT id $ nng g + let nng = normalNormalGammaMeasure 100 2 6 1 0.5 + anng = altNormalNormalGammaMeasure 100 2 6 1 0.5 + m0 <- withSystemRandom . asGenIO $ \g -> + expectationT id $ nng g - p <- withSystemRandom . asGenIO $ \g -> - expectationT id $ 2 `to` 3 <$> nng g + m1 <- withSystemRandom . asGenIO $ \g -> + expectationT id $ anng g - print m - print p + p0 <- withSystemRandom . asGenIO $ \g -> + expectationT id $ 2 `to` 3 <$> nng g + + p1 <- withSystemRandom . asGenIO $ \g -> + expectationT id $ 2 `to` 3 <$> anng g + + print m0 + print m1 + + print p0 + print p1