Hello community,
here is the log from the commit of package ghc-mwc-probability for
openSUSE:Factory checked in at 2016-11-10 13:20:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-mwc-probability (Old)
and /work/SRC/openSUSE:Factory/.ghc-mwc-probability.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-mwc-probability"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-mwc-probability/ghc-mwc-probability.changes
2016-10-22 13:13:42.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-mwc-probability.new/ghc-mwc-probability.changes
2016-11-10 13:20:10.000000000 +0100
@@ -1,0 +2,5 @@
+Sun Oct 30 16:27:00 UTC 2016 - [email protected]
+
+- Update to version 1.2.2 with cabal2obs.
+
+-------------------------------------------------------------------
Old:
----
mwc-probability-1.2.1.tar.gz
New:
----
mwc-probability-1.2.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-mwc-probability.spec ++++++
--- /var/tmp/diff_new_pack.yjC1JC/_old 2016-11-10 13:20:10.000000000 +0100
+++ /var/tmp/diff_new_pack.yjC1JC/_new 2016-11-10 13:20:10.000000000 +0100
@@ -18,21 +18,19 @@
%global pkg_name mwc-probability
Name: ghc-%{pkg_name}
-Version: 1.2.1
+Version: 1.2.2
Release: 0
Summary: Sampling function-based probability distributions
License: MIT
-Group: System/Libraries
+Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
BuildRequires: ghc-Cabal-devel
-# Begin cabal-rpm deps:
BuildRequires: ghc-mwc-random-devel
BuildRequires: ghc-primitive-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-transformers-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
%description
A simple probability distribution type, where distributions are characterized
@@ -75,15 +73,12 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-
%build
%ghc_lib_build
-
%install
%ghc_lib_install
-
%post devel
%ghc_pkg_recache
++++++ mwc-probability-1.2.1.tar.gz -> mwc-probability-1.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mwc-probability-1.2.1/mwc-probability.cabal
new/mwc-probability-1.2.2/mwc-probability.cabal
--- old/mwc-probability-1.2.1/mwc-probability.cabal 2016-03-03
20:45:52.000000000 +0100
+++ new/mwc-probability-1.2.2/mwc-probability.cabal 2016-10-28
04:06:48.000000000 +0200
@@ -1,5 +1,5 @@
name: mwc-probability
-version: 1.2.1
+version: 1.2.2
homepage: http://github.com/jtobin/mwc-probability
license: MIT
license-file: LICENSE
@@ -51,8 +51,8 @@
default-language: Haskell2010
hs-source-dirs: src
build-depends:
- base < 5
- , mwc-random
+ base > 4 && < 6
+ , mwc-random > 0.13 && < 0.14
, primitive
, transformers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mwc-probability-1.2.1/src/System/Random/MWC/Probability.hs
new/mwc-probability-1.2.2/src/System/Random/MWC/Probability.hs
--- old/mwc-probability-1.2.1/src/System/Random/MWC/Probability.hs
2016-03-03 20:52:56.000000000 +0100
+++ new/mwc-probability-1.2.2/src/System/Random/MWC/Probability.hs
2016-10-28 04:34:45.000000000 +0200
@@ -103,13 +103,13 @@
{-# INLINABLE samples #-}
instance Monad m => Functor (Prob m) where
- fmap h (Prob f) = Prob $ liftM h . f
+ fmap h (Prob f) = Prob $ fmap h . f
instance Monad m => Applicative (Prob m) where
pure = return
(<*>) = ap
-instance (Applicative m, Monad m, Num a) => Num (Prob m a) where
+instance (Monad m, Num a) => Num (Prob m a) where
(+) = liftA2 (+)
(-) = liftA2 (-)
(*) = liftA2 (*)
@@ -135,24 +135,39 @@
primitive = lift . primitive
{-# INLINE primitive #-}
--- | The uniform distribution.
+-- | The uniform distribution over a type.
+--
+-- >>> gen <- create
+-- >>> sample uniform gen :: IO Double
+-- 0.29308497534914946
+-- >>> sample uniform gen :: IO Bool
+-- False
uniform :: (PrimMonad m, Variate a) => Prob m a
uniform = Prob QMWC.uniform
{-# INLINABLE uniform #-}
-- | The uniform distribution over the provided interval.
+--
+-- >>> sample (uniformR (0, 1)) gen
+-- 0.44984153252922365
uniformR :: (PrimMonad m, Variate a) => (a, a) -> Prob m a
uniformR r = Prob $ QMWC.uniformR r
{-# INLINABLE uniformR #-}
-- | The discrete uniform distribution.
+--
+-- >>> sample (discreteUniform [0..10]) gen
+-- 6
+-- >>> sample (discreteUniform "abcdefghijklmnopqrstuvwxyz") gen
+-- 'a'
discreteUniform :: (PrimMonad m, Foldable f) => f a -> Prob m a
discreteUniform cs = do
j <- uniformR (0, length cs - 1)
return $ F.toList cs !! j
{-# INLINABLE discreteUniform #-}
--- | The standard normal distribution (a Gaussian with mean 0 and variance 1).
+-- | The standard normal or Gaussian distribution (with mean 0 and standard
+-- deviation 1).
standard :: PrimMonad m => Prob m Double
standard = Prob MWC.Dist.standard
{-# INLINABLE standard #-}
@@ -168,12 +183,18 @@
logNormal m sd = exp <$> normal m sd
{-# INLINABLE logNormal #-}
--- | The exponential distribution.
+-- | The exponential distribution with provided rate parameter.
exponential :: PrimMonad m => Double -> Prob m Double
exponential r = Prob $ MWC.Dist.exponential r
{-# INLINABLE exponential #-}
--- | The gamma distribution.
+-- | The gamma distribution with shape parameter a and scale parameter b.
+--
+-- This is the parameterization used more traditionally in frequentist
+-- statistics. It has the following corresponding probability density
+-- function:
+--
+-- f(x; a, b) = 1 / (Gamma(a) * b ^ a) x ^ (a - 1) e ^ (- x / b)
gamma :: PrimMonad m => Double -> Double -> Prob m Double
gamma a b = Prob $ MWC.Dist.gamma a b
{-# INLINABLE gamma #-}
@@ -204,8 +225,7 @@
return $ fmap (/ sum zs) zs
{-# INLINABLE dirichlet #-}
--- | The symmetric Dirichlet distribution (with equal concentration
--- parameters).
+-- | The symmetric Dirichlet distribution of dimension n.
symmetricDirichlet :: PrimMonad m => Int -> Double -> Prob m [Double]
symmetricDirichlet n a = dirichlet (replicate n a)
{-# INLINABLE symmetricDirichlet #-}
@@ -217,7 +237,7 @@
-- | The binomial distribution.
binomial :: PrimMonad m => Int -> Double -> Prob m Int
-binomial n p = liftM (length . filter id) $ replicateM n (bernoulli p)
+binomial n p = fmap (length . filter id) $ replicateM n (bernoulli p)
{-# INLINABLE binomial #-}
-- | The multinomial distribution.