Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-MonadRandom for openSUSE:Factory 
checked in at 2021-04-24 23:08:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-MonadRandom (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-MonadRandom.new.12324 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-MonadRandom"

Sat Apr 24 23:08:56 2021 rev:3 rq:888028 version:0.5.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-MonadRandom/ghc-MonadRandom.changes  
2020-12-22 11:33:49.449159508 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-MonadRandom.new.12324/ghc-MonadRandom.changes   
    2021-04-24 23:10:06.191475414 +0200
@@ -1,0 +2,11 @@
+Thu Apr  8 20:14:44 UTC 2021 - psim...@suse.com
+
+- Update MonadRandom to version 0.5.3.
+  0.5.3 (8 April 2021)
+  --------------------
+
+  - `StatefulGen` instances for `RandT`
+  - Addition of `RandGen`
+  - Additioon of `withRandGen` and `withRandGen_`
+
+-------------------------------------------------------------------

Old:
----
  MonadRandom-0.5.2.tar.gz

New:
----
  MonadRandom-0.5.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-MonadRandom.spec ++++++
--- /var/tmp/diff_new_pack.Y67TLn/_old  2021-04-24 23:10:06.651476065 +0200
+++ /var/tmp/diff_new_pack.Y67TLn/_new  2021-04-24 23:10:06.655476070 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-MonadRandom
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %global pkg_name MonadRandom
 Name:           ghc-%{pkg_name}
-Version:        0.5.2
+Version:        0.5.3
 Release:        0
 Summary:        Random-number generation monad
 License:        BSD-3-Clause

++++++ MonadRandom-0.5.2.tar.gz -> MonadRandom-0.5.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MonadRandom-0.5.2/CHANGES.markdown 
new/MonadRandom-0.5.3/CHANGES.markdown
--- old/MonadRandom-0.5.2/CHANGES.markdown      2001-09-09 03:46:40.000000000 
+0200
+++ new/MonadRandom-0.5.3/CHANGES.markdown      2001-09-09 03:46:40.000000000 
+0200
@@ -1,3 +1,10 @@
+0.5.3 (8 April 2021)
+--------------------
+
+- `StatefulGen` instances for `RandT`
+- Addition of `RandGen`
+- Additioon of `withRandGen` and `withRandGen_`
+
 0.5.2 (24 June 2020)
 --------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MonadRandom-0.5.2/Control/Monad/Trans/Random/Lazy.hs 
new/MonadRandom-0.5.3/Control/Monad/Trans/Random/Lazy.hs
--- old/MonadRandom-0.5.2/Control/Monad/Trans/Random/Lazy.hs    2001-09-09 
03:46:40.000000000 +0200
+++ new/MonadRandom-0.5.3/Control/Monad/Trans/Random/Lazy.hs    2001-09-09 
03:46:40.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP                        #-}
 {-# LANGUAGE FlexibleInstances          #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE MultiParamTypeClasses      #-}
@@ -46,6 +47,10 @@
     liftListen,
     liftPass,
     evalRandTIO,
+    -- * StatefulGen interface
+    RandGen(..),
+    withRandGen,
+    withRandGen_,
     -- * Examples
     -- ** Random monads
     -- $examples
@@ -65,9 +70,13 @@
 import           Control.Monad.Signatures
 import           Control.Monad.Trans.Class
 import qualified Control.Monad.Trans.State.Lazy as LazyState
+import           Control.Monad.Trans.Random.Strict (RandGen(..))
 import           Data.Functor.Identity
+#if MIN_VERSION_random(1,2,0)
+import           System.Random.Stateful
+#else
 import           System.Random
-
+#endif
 -- | A random monad parameterized by the type @g@ of the generator to carry.
 --
 -- The 'return' function leaves the generator unchanged, while '>>=' uses the
@@ -261,6 +270,60 @@
 evalRandTIO :: (MonadIO m) => RandT StdGen m a -> m a
 evalRandTIO t = liftIO newStdGen >>= evalRandT t
 
+#if MIN_VERSION_random(1,2,0)
+-- |
+--
+-- @since 0.5.3
+instance (Monad m, RandomGen g) => StatefulGen (RandGen g) (RandT g m) where
+  uniformWord32R r = applyRandT (genWord32R r)
+  uniformWord64R r = applyRandT (genWord64R r)
+  uniformWord8 = applyRandT genWord8
+  uniformWord16 = applyRandT genWord16
+  uniformWord32 = applyRandT genWord32
+  uniformWord64 = applyRandT genWord64
+  uniformShortByteString n = applyRandT (genShortByteString n)
+
+-- |
+--
+-- @since 0.5.3
+instance (Monad m, RandomGen g) => RandomGenM (RandGen g) g (RandT g m) where
+  applyRandomGenM = applyRandT
+
+applyRandT :: Applicative m => (g -> (a, g)) -> RandGen g -> RandT g m a
+applyRandT f _ = liftRandT (pure . f)
+#endif
+
+-- | A `RandT` runner that allows using it with `StatefulGen` restricted 
actions. Returns
+-- the outcome of random computation and the new pseudo-random-number generator
+--
+-- >>> withRandGen (mkStdGen 2021) uniformM :: IO (Int, StdGen)
+-- (6070831465987696718,StdGen {unStdGen = SMGen 4687568268719557181 
4805600293067301895})
+--
+-- @since 0.5.3
+withRandGen ::
+     g
+  -- ^ initial generator
+  -> (RandGen g -> RandT g m a)
+  -> m (a, g)
+  -- ^ return value and final generator
+withRandGen g action = runRandT (action RandGen) g
+
+-- | Same as `withRandGen`, but discards the resulting generator.
+--
+-- >>> withRandGen_ (mkStdGen 2021) uniformM :: IO Int
+-- 6070831465987696718
+--
+-- @since 0.5.3
+withRandGen_ ::
+     Monad m
+  => g
+  -- ^ initial generator
+  -> (RandGen g -> RandT g m a)
+  -> m a
+  -- ^ return value and final generator
+withRandGen_ g action = evalRandT (action RandGen) g
+
+
 {- $examples
 
 The @die@ function simulates the roll of a die, picking a number between 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MonadRandom-0.5.2/Control/Monad/Trans/Random/Strict.hs 
new/MonadRandom-0.5.3/Control/Monad/Trans/Random/Strict.hs
--- old/MonadRandom-0.5.2/Control/Monad/Trans/Random/Strict.hs  2001-09-09 
03:46:40.000000000 +0200
+++ new/MonadRandom-0.5.3/Control/Monad/Trans/Random/Strict.hs  2001-09-09 
03:46:40.000000000 +0200
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP                        #-}
 {-# LANGUAGE FlexibleInstances          #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE MultiParamTypeClasses      #-}
@@ -47,6 +48,10 @@
     liftCatch,
     liftListen,
     liftPass,
+    -- * StatefulGen interface
+    RandGen(..),
+    withRandGen,
+    withRandGen_,
     -- * Examples
     -- ** Random monads
     -- $examples
@@ -67,7 +72,11 @@
 import           Control.Monad.Trans.Class
 import qualified Control.Monad.Trans.State.Strict as StrictState
 import           Data.Functor.Identity
+#if MIN_VERSION_random(1,2,0)
+import           System.Random.Stateful
+#else
 import           System.Random
+#endif
 
 -- | A random monad parameterized by the type @g@ of the generator to carry.
 --
@@ -262,6 +271,67 @@
 evalRandTIO :: (MonadIO m) => RandT StdGen m a -> m a
 evalRandTIO t = liftIO newStdGen >>= evalRandT t
 
+
+-- | A proxy that carries information about the type of generator to use with 
@RandT@
+-- monad and its `StatefulGen` instance.
+--
+-- @since 0.5.3
+data RandGen g = RandGen
+
+#if MIN_VERSION_random(1,2,0)
+-- |
+--
+-- @since 0.5.3
+instance (Monad m, RandomGen g) => StatefulGen (RandGen g) (RandT g m) where
+  uniformWord32R r = applyRandT (genWord32R r)
+  uniformWord64R r = applyRandT (genWord64R r)
+  uniformWord8 = applyRandT genWord8
+  uniformWord16 = applyRandT genWord16
+  uniformWord32 = applyRandT genWord32
+  uniformWord64 = applyRandT genWord64
+  uniformShortByteString n = applyRandT (genShortByteString n)
+
+-- |
+--
+-- @since 0.5.3
+instance (Monad m, RandomGen g) => RandomGenM (RandGen g) g (RandT g m) where
+  applyRandomGenM = applyRandT
+
+applyRandT :: Applicative m => (g -> (a, g)) -> RandGen g -> RandT g m a
+applyRandT f _ = liftRandT (pure . f)
+#endif
+
+-- | A `RandT` runner that allows using it with `StatefulGen` restricted 
actions. Returns
+-- the outcome of random computation and the new pseudo-random-number generator
+--
+-- >>> withRandGen (mkStdGen 2021) uniformM :: IO (Int, StdGen)
+-- (6070831465987696718,StdGen {unStdGen = SMGen 4687568268719557181 
4805600293067301895})
+--
+-- @since 0.5.3
+withRandGen ::
+     g
+  -- ^ initial generator
+  -> (RandGen g -> RandT g m a)
+  -> m (a, g)
+  -- ^ return value and final generator
+withRandGen g action = runRandT (action RandGen) g
+
+-- | Same as `withRandGen`, but discards the resulting generator.
+--
+-- >>> withRandGen_ (mkStdGen 2021) uniformM :: IO Int
+-- 6070831465987696718
+--
+-- @since 0.5.3
+withRandGen_ ::
+     Monad m
+  => g
+  -- ^ initial generator
+  -> (RandGen g -> RandT g m a)
+  -> m a
+  -- ^ return value and final generator
+withRandGen_ g action = evalRandT (action RandGen) g
+
+
 {- $examples
 
 The @die@ function simulates the roll of a die, picking a number between 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MonadRandom-0.5.2/MonadRandom.cabal 
new/MonadRandom-0.5.3/MonadRandom.cabal
--- old/MonadRandom-0.5.2/MonadRandom.cabal     2001-09-09 03:46:40.000000000 
+0200
+++ new/MonadRandom-0.5.3/MonadRandom.cabal     2001-09-09 03:46:40.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                MonadRandom
-version:             0.5.2
+version:             0.5.3
 synopsis:            Random-number generation monad.
 description:         Support for computations which consume random values.
 license:             BSD3

Reply via email to