diff --git a/random.cabal b/random.cabal index 2d4f18d2153071670d1b1246e57eefd61ca6c92b..2d4434513271f1d281cae5c4315b99ea7cf7649a 100644 --- a/random.cabal +++ b/random.cabal @@ -75,9 +75,9 @@ library -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base >=4.8 && <4.12 + build-depends: base >=4.8 && <4.14 ,ghc-prim - ,entropy == 0.3.* + ,entropy == 0.4.* ,numeric-extras == 0.1.* ,primitive >= 0.6 ,transformers >= 0.2 diff --git a/src/System/Random.hs b/src/System/Random.hs index f6bde7f353cf52edd74d019fd413108b7186fc0b..c40e9f774cdc756e6cd029c85e4c4bf19f88b52c 100644 --- a/src/System/Random.hs +++ b/src/System/Random.hs @@ -66,8 +66,9 @@ module System.Random -- * Random values of various types , Random ( random, randomR, - randoms, randomRs, - randomIO, randomRIO ) + randoms, randomRs + --randomIO, randomRIO + ) -- * References -- $references @@ -83,17 +84,17 @@ import Foreign.C.Types ---import Data.Ratio ( numerator, denominator ) +import Data.Ratio ( numerator, denominator ) ---import Data.Char ( isSpace, chr, ord ) ---import System.IO.Unsafe ( unsafePerformIO ) ---import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) +import Data.Char ( isSpace, chr, ord ) +import System.IO.Unsafe ( unsafePerformIO ) +import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) #if MIN_VERSION_base (4,6,0) ---import Data.IORef ( atomicModifyIORef' ) +import Data.IORef ( atomicModifyIORef' ) #else import Data.IORef ( atomicModifyIORef ) #endif ---import Numeric ( readDec ) +import Numeric ( readDec ) #ifdef __GLASGOW_HASKELL__ import GHC.Exts ( build ) @@ -134,7 +135,7 @@ class RandomGen g where -- -- * If @(a,b) = 'genRange' g@, then @a < b@. -- - -- * 'genRange' always returns a pair of defined 'Int's. + -- * 'genRange' always returns a pair of defined 'Word64's. -- -- The second condition ensures that 'genRange' cannot examine its -- argument, and hence the value it returns can be determined only by the @@ -143,7 +144,7 @@ class RandomGen g where -- being concerned that the generator returned by (say) 'next' might have -- a different range to the generator passed to 'next'. -- - -- The default definition spans the full range of 'Int'. + -- The default definition spans the full range of 'Word64'. genRange :: g -> (Word64,Word64) -- default method @@ -294,12 +295,12 @@ class Random a where -- | A variant of 'randomR' that uses the global random number generator -- (see "System.Random#globalrng"). - randomRIO :: (a,a) -> IO a + --randomRIO :: (a,a) -> IO a --randomRIO range = getStdRandom (randomR range) -- | A variant of 'random' that uses the global random number generator -- (see "System.Random#globalrng"). - randomIO :: IO a + --randomIO :: IO a --randomIO = getStdRandom random -- | Produce an infinite list-equivalent of random values. @@ -354,10 +355,10 @@ instance Random CIntMax where randomR = randomIvalIntegral; random = randomBo instance Random CUIntMax where randomR = randomIvalIntegral; random = randomBounded instance Random Char where - --randomR (a,b) g = - -- case (randomIvalInteger (toInteger (ord a), toInteger (ord b)) g) of - -- (x,g') -> (chr x, g') - --random g = randomR (minBound,maxBound) g + randomR (a,b) g = + case (randomIvalInteger (toInteger (ord a), toInteger (ord b)) g) of + (x,g') -> (chr x, g') + random g = randomR (minBound,maxBound) g instance Random Bool where randomR (a,b) g =