mwc-random-monad 0.7.2.0 → 0.7.3.0
raw patch · 2 files changed
+18/−7 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ System.Random.MWC.Monad: runWithSystemRandomT :: (MonadPrim m, BasePrimMonad m ~ IO) => Rand m a -> m a
- System.Random.MWC.Monad: runWithSystemRandom :: (MonadPrim m, BasePrimMonad m ~ IO) => Rand m a -> m a
+ System.Random.MWC.Monad: runWithSystemRandom :: (MonadPrim m, BasePrimMonad m ~ m) => Rand m a -> IO a
Files
- System/Random/MWC/Monad.hs +15/−4
- mwc-random-monad.cabal +3/−3
System/Random/MWC/Monad.hs view
@@ -27,6 +27,7 @@ , runWithSeed , runWithVector , runWithSystemRandom+ , runWithSystemRandomT -- * Random numbers generation , uniform , uniformR@@ -123,12 +124,22 @@ runWithSeed seed m = runRand m =<< liftPrim (MWC.restore seed) {-# INLINE runWithSeed #-} --- | Run monad using system random-runWithSystemRandom :: (MonadPrim m, BasePrimMonad m ~ IO) => Rand m a -> m a-runWithSystemRandom rnd- = runRand rnd =<< liftPrim MWC.createSystemRandom+-- | Run monad using seed obtained from system's fast source of+-- pseudo-random numbers ("\/dev\/urandom" on Unix-like+-- systems). @m@ must be either IO or ST.+runWithSystemRandom :: (MonadPrim m, BasePrimMonad m ~ m) => Rand m a -> IO a+runWithSystemRandom rnd = do+ MWC.withSystemRandom $ \g -> runRand rnd g {-# INLINE runWithSystemRandom #-} +-- | Run monad using seed obtained from system's fast source of+-- pseudo-random numbers ("\/dev\/urandom" on Unix-like+-- systems). Unlike 'runWithSystemRandom' it could be used with+-- monad stacks.+runWithSystemRandomT :: (MonadPrim m, BasePrimMonad m ~ IO) => Rand m a -> m a+runWithSystemRandomT rnd+ = runRand rnd =<< liftPrim MWC.createSystemRandom+{-# INLINE runWithSystemRandomT #-} ----------------------------------------------------------------
mwc-random-monad.cabal view
@@ -1,10 +1,10 @@ Name: mwc-random-monad-Version: 0.7.2.0+Version: 0.7.3.0 License: BSD3 License-file: LICENSE Author: Alexey Khudyakov <alexey.skladnoy@gmail.com> Maintainer: Alexey Khudyakov <alexey.skladnoy@gmail.com>-bug-reports: https://bitbucket.org/Shimuuar/mwc-random-monad/issues+bug-reports: https://github.com/Shimuuar/mwc-random-monad/issues Category: Math, Statistics Build-type: Simple Cabal-version: >=1.6@@ -37,5 +37,5 @@ source-repository head type: git- location: git://github.com/Shimuuar/mwc-random+ location: git://github.com/Shimuuar/mwc-random-monad