commit 9e1f82b11e653621e9e7eb64bf969c19b06c708d parent 1ada45092e9afced4cbab8fd3a19b469e102d7fe Author: Jared Tobin <jared@jtobin.ca> Date: Tue, 16 May 2017 21:59:20 +1200 Minor code tweak. Diffstat:
M | src/System/Random/MWC/Probability.hs | | | 6 | +++--- |
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/System/Random/MWC/Probability.hs b/src/System/Random/MWC/Probability.hs @@ -103,7 +103,7 @@ samples n model gen = replicateM n (sample model gen) {-# INLINABLE samples #-} instance Monad m => Functor (Prob m) where - fmap h (Prob f) = Prob $ fmap h . f + fmap h (Prob f) = Prob (\x -> fmap h (f x)) instance Monad m => Applicative (Prob m) where pure = return @@ -118,8 +118,8 @@ instance (Monad m, Num a) => Num (Prob m a) where fromInteger = pure . fromInteger instance Monad m => Monad (Prob m) where - return = Prob . const . return - m >>= h = Prob $ \g -> do + return x = Prob (const (return x)) + m >>= h = Prob $ \g -> do z <- sample m g sample (h z) g {-# INLINABLE (>>=) #-}