packages feed

random-fu 0.2.3.1 → 0.2.4.0

raw patch · 2 files changed

+20/−13 lines, 2 files

Files

random-fu.cabal view
@@ -1,5 +1,5 @@ name:                   random-fu-version:                0.2.3.1+version:                0.2.4.0 stability:              provisional  cabal-version:          >= 1.6@@ -29,6 +29,9 @@                         a fair bit slower than straight C implementations of                          the same algorithms.                         .+                        Changes in 0.2.4.0: Added a Lift instance that resolves+                        a common overlapping-instance issue in user code.+                        .                         Changes in 0.2.3.1: Should now build on GHC 7.6                         .                         Changes in 0.2.3.0: Added stretched exponential distribution,@@ -40,16 +43,8 @@                         to newtypes, updated types for GHC 7.4's removal of Eq                          and Show from the context of Num, and added RVarT versions                         of random variables in Data.Random.List-                        .-                        Changes in 0.2.1.0: Exposed Categorical type (it-                        had been hidden by accident a few version ago),-                        gave it a Read instance, and dropped a -                        no-longer-necessary Ord context from 'fromWeightedList'.-                        Thank you Antal Spector-Zabusky for catching these! -tested-with:            GHC == 6.10.4, GHC == 6.12.1, GHC == 6.12.3,-                        GHC == 7.0.1, GHC == 7.0.2, GHC == 7.0.4,-                        GHC == 7.2.2, GHC == 7.4.1-rc1+tested-with:            GHC == 7.4.2, GHC == 7.6.1  source-repository head   type:                 git
src/Data/Random/Lift.hs view
@@ -34,7 +34,7 @@ instance Lift m m where     lift = id --- | This instance is incoherent with the other two. However,+-- | This instance is incoherent with the others. However, -- by the law @lift (return x) == return x@, the results -- must always be the same. instance Monad m => Lift T.Identity m where@@ -43,16 +43,28 @@ instance Lift (RVarT T.Identity) (RVarT m) where     lift x = runRVar x StdRandom +-- | This instance is again incoherent with the others, but provides a+-- more-specific instance to resolve the overlap between the+-- @Lift m (t m)@ and @Lift Identity m@ instances.+instance T.MonadTrans t => Lift T.Identity (t T.Identity) where+    lift = T.lift+ #ifndef MTL2 --- | This instance is incoherent with the other two. However,+-- | This instance is incoherent with the others. However, -- by the law @lift (return x) == return x@, the results -- must always be the same. instance Monad m => Lift MTL.Identity m where     lift = return . MTL.runIdentity  instance Lift (RVarT MTL.Identity) (RVarT m) where-    lift x = runRVar x StdRandom+    lift x = runRVarTWith (return . MTL.runIdentity) x StdRandom++-- | This instance is again incoherent with the others, but provides a+-- more-specific instance to resolve the overlap between the+-- @Lift m (t m)@ and @Lift Identity m@ instances.+instance T.MonadTrans t => Lift MTL.Identity (t MTL.Identity) where+    lift = T.lift  #endif