packages feed

random-fu 0.2.7.3 → 0.2.7.4

raw patch · 17 files changed

+38/−8 lines, 17 filesdep ~base

Dependency ranges changed: base

Files

random-fu.cabal view
@@ -1,5 +1,5 @@ name:                   random-fu-version:                0.2.7.3+version:                0.2.7.4 stability:              provisional  cabal-version:          >= 1.6
src/Data/Random/Distribution/Bernoulli.hs view
@@ -5,6 +5,8 @@     TemplateHaskell   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Bernoulli where  import Data.Random.Internal.TH
src/Data/Random/Distribution/Beta.hs view
@@ -5,6 +5,8 @@     TemplateHaskell   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Beta where  import Data.Random.Internal.TH
src/Data/Random/Distribution/Binomial.hs view
@@ -5,6 +5,8 @@     BangPatterns   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Binomial where  import Data.Random.Internal.TH
src/Data/Random/Distribution/Categorical.hs view
@@ -4,6 +4,8 @@     CPP   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Categorical     ( Categorical     , categorical, categoricalT@@ -21,7 +23,6 @@ import Control.Arrow import Control.Monad import Control.Monad.ST-import Control.Applicative import Data.Foldable (Foldable(foldMap)) import Data.STRef import Data.Traversable (Traversable(traverse, sequenceA))@@ -112,7 +113,7 @@  instance (Fractional p, Ord p, Distribution Uniform p) => Distribution (Categorical p) a where     rvarT (Categorical ds)-        | V.null ds = fail "categorical distribution over empty set cannot be sampled"+        | V.null ds = error "categorical distribution over empty set cannot be sampled"         | n == 1    = return (snd (V.head ds))         | otherwise = do             u <- uniformT 0 (fst (V.last ds))@@ -158,7 +159,9 @@          -- I'm not entirely sure whether this is a valid form of failure; see next     -- set of comments.+#if __GLASGOW_HASKELL__ < 808     fail _ = Categorical V.empty+#endif          -- Should the normalize step be included here, or should normalization     -- be assumed?  It seems like there is (at least) 1 valid situation where
src/Data/Random/Distribution/ChiSquare.hs view
@@ -2,6 +2,9 @@         MultiParamTypeClasses, FlexibleInstances, FlexibleContexts,         UndecidableInstances   #-}++{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.ChiSquare where  import Data.Random.RVar@@ -22,7 +25,7 @@     rvarT (ChiSquare 0) = return 0     rvarT (ChiSquare n)         | n > 0     = gammaT (0.5 * fromInteger n) 2-        | otherwise = fail "chi-square distribution: degrees of freedom must be positive"+        | otherwise = error "chi-square distribution: degrees of freedom must be positive"  instance (Real t, Distribution ChiSquare t) => CDF ChiSquare t where     cdf (ChiSquare n) x = incompleteGamma (0.5 * fromInteger n) (0.5 * realToFrac x)
src/Data/Random/Distribution/Exponential.hs view
@@ -4,6 +4,8 @@     UndecidableInstances   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Exponential where  import Data.Random.RVar
src/Data/Random/Distribution/Gamma.hs view
@@ -4,6 +4,8 @@     UndecidableInstances, BangPatterns   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Gamma     ( Gamma(..)     , gamma, gammaT
src/Data/Random/Distribution/Normal.hs view
@@ -3,6 +3,9 @@     UndecidableInstances, ForeignFunctionInterface, BangPatterns,      RankNTypes   #-}++{-# OPTIONS_GHC -fno-warn-type-defaults #-}+ module Data.Random.Distribution.Normal     ( Normal(..)     , normal, normalT
src/Data/Random/Distribution/Pareto.hs view
@@ -2,6 +2,9 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-}++{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Pareto where  import Data.Random
src/Data/Random/Distribution/Poisson.hs view
@@ -4,6 +4,8 @@     TemplateHaskell   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Poisson where  import Data.Random.Internal.TH
src/Data/Random/Distribution/Rayleigh.hs view
@@ -4,6 +4,8 @@         UndecidableInstances   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.Rayleigh where  import Data.Random.RVar
src/Data/Random/Distribution/Simplex.hs view
@@ -11,7 +11,6 @@     , fractionalStdSimplex     ) where -import Control.Applicative import Control.Monad import Data.List import Data.Random.RVar
src/Data/Random/Distribution/StretchedExponential.hs view
@@ -4,6 +4,8 @@     UndecidableInstances   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.StretchedExponential where  import Data.Random.RVar
src/Data/Random/Distribution/T.hs view
@@ -10,6 +10,8 @@ {-# OPTIONS_GHC -fno-warn-missing-methods  #-} {-# OPTIONS_GHC -fno-warn-orphans          #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Distribution.T where  import Data.RVar@@ -34,7 +36,7 @@             x <- stdNormalT             y <- chiSquareT n             return (x * sqrt (fromInteger n / y))-        | otherwise = fail "Student's t-distribution: degrees of freedom must be positive"+        | otherwise = error "Student's t-distribution: degrees of freedom must be positive"  instance (Real a, Distribution T a) => CDF T a where     cdf (T n) t = incompleteBeta v2 v2 x
src/Data/Random/Sample.hs view
@@ -4,6 +4,8 @@         IncoherentInstances   #-} +{-# OPTIONS_GHC -fno-warn-simplifiable-class-constraints #-}+ module Data.Random.Sample where  import Control.Monad.State 
src/Data/Random/Vector.hs view
@@ -3,8 +3,7 @@ import           Data.Random.RVar import           Data.Random.Distribution.Uniform import qualified Data.Vector  as V-import           Control.Applicative  -- | Take a random element of a vector. randomElement :: V.Vector a -> RVar a-randomElement words = (words V.!) <$> uniform 0 (V.length words - 1)+randomElement wrds = (wrds V.!) <$> uniform 0 (V.length wrds - 1)