random-bytestring 0.1.3 → 0.1.3.1
raw patch · 4 files changed
+51/−14 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +6/−0
- benchmark/Implementations.hs +13/−4
- benchmark/benchmark.hs +6/−1
- random-bytestring.cabal +26/−9
CHANGELOG.md view
@@ -1,3 +1,9 @@+0.1.3.1 (2018-03-18)+====================++* Put dependency on pcg-random behind a cabal flag, which is on by default.+ This enables builds stackage nightly.+ 0.1.3 (2018-03-17) ==================
benchmark/Implementations.hs view
@@ -1,13 +1,14 @@-{-# LANGUAGE UnicodeSyntax #-}-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UnboxedTuples #-}-{-# LANGUAGE BangPatterns #-}+{-# LANGUAGE UnicodeSyntax #-} -- -------------------------------------------------------------------------- -- -- | -- Module: Implementations--- Copyright: (c) Lars Kuhtz <lakuhtz@gmail.com> 2017+-- Copyright: (c) Lars Kuhtz <lakuhtz@gmail.com> 2017-2018 -- License: MIT -- Maintainer: lakuhtz@gmail.com -- Stability: experimental@@ -29,8 +30,10 @@ , mwcMalloc32 , mwcMalloc64 +#ifdef MIN_VERSION_pcg_random -- , pcgMalloc64+#endif ) where import Control.Exception (bracketOnError)@@ -52,7 +55,9 @@ import System.Entropy (getEntropy) import System.Random (randoms, getStdGen) import qualified System.Random.MWC as MWC (uniform, create, Gen)+#ifdef MIN_VERSION_pcg_random import qualified System.Random.PCG as PCG (uniform, create, Gen)+#endif import Benchmarks @@ -70,7 +75,9 @@ , Impl "mwc-malloc-8" mwcMalloc8 , Impl "mwc-malloc-32" mwcMalloc32 , Impl "mwc-malloc-64" mwcMalloc64+#ifdef MIN_VERSION_pcg_random , Impl "pcg-malloc-64" pcgMalloc64+#endif ] -- -------------------------------------------------------------------------- --@@ -243,6 +250,7 @@ let !(# !s', !b #) = internal (MWC.uniform gen ∷ IO Word8) s in Just (b, Box s') +#ifdef MIN_VERSION_pcg_random -- -------------------------------------------------------------------------- -- -- PCG Malloc64 @@ -281,4 +289,5 @@ poke curPtr b loop8 $ curPtr `plusPtr` 1 | otherwise = return ()+#endif
benchmark/benchmark.hs view
@@ -1,9 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE UnicodeSyntax #-} -- -------------------------------------------------------------------------- -- -- | -- Module: Main --- Copyright: (c) Lars Kuhtz <lakuhtz@gmail.com> 2017 +-- Copyright: (c) Lars Kuhtz <lakuhtz@gmail.com> 2017-2018 -- License: MIT -- Maintainer: lakuhtz@gmail.com -- Stability: experimental @@ -17,11 +18,15 @@ import Benchmarks import Criterion.Main import qualified Data.ByteString.Random.MWC as MWC +#ifdef MIN_VERSION_pcg_random import qualified Data.ByteString.Random.PCG as PCG +#endif main ∷ IO () main = defaultMain $ compareBenchmarks [ Impl "random-bytestring+mwc" MWC.random +#ifdef MIN_VERSION_pcg_random , Impl "random-bytestring+pcg" PCG.random +#endif ]
random-bytestring.cabal view
@@ -1,5 +1,5 @@ Name: random-bytestring-Version: 0.1.3+Version: 0.1.3.1 Synopsis: Efficient generation of random bytestrings Description: Efficient generation of random bytestrings. The implementation@@ -18,9 +18,9 @@ applications. They are /not/ suitable for cryptographic applications. .- +  .- +  Homepage: https://www.github.com/larskuhtz/random-bytestring License: MIT@@ -43,6 +43,10 @@ type: git location: https://www.github.com/larskuhtz/random-bytestring +flag with-pcg+ Description: compile with support for PCG from pcg-random+ default: True+ Library default-language: Haskell2010 hs-source-dirs: src@@ -50,19 +54,23 @@ exposed-modules: Data.ByteString.Random Data.ByteString.Random.Internal- Data.ByteString.Random.PCG Data.ByteString.Random.MWC build-depends: base >= 4.7 && < 4.12, bytestring >= 0.10,- mwc-random >= 0.13,- pcg-random >= 0.1+ mwc-random >= 0.13 if impl(ghc < 7.10) build-depends: nats >= 1.1 + if flag(with-pcg)+ exposed-modules:+ Data.ByteString.Random.PCG+ build-depends:+ pcg-random >= 0.1+ ghc-options: -Wall -O2 Benchmark benchmark@@ -80,7 +88,6 @@ entropy >= 0.3, ghc-prim >= 0.3, mwc-random >= 0.13,- pcg-random >= 0.1, primitive >= 0.6, random >= 1.1, cryptonite >= 0.24@@ -92,6 +99,10 @@ if impl(ghc < 7.10) buildable: False + if flag(with-pcg)+ build-depends:+ pcg-random >= 0.1+ other-modules: Benchmarks Implementations@@ -111,7 +122,6 @@ entropy >= 0.3, ghc-prim >= 0.3, mwc-random >= 0.13,- pcg-random >= 0.1, primitive >= 0.6, random >= 1.1, cryptonite >= 0.24@@ -123,6 +133,10 @@ if impl(ghc < 7.10) buildable: False + if flag(with-pcg)+ build-depends:+ pcg-random >= 0.1+ other-modules: Benchmarks, Implementations@@ -142,7 +156,6 @@ entropy >= 0.3, ghc-prim >= 0.3, mwc-random >= 0.13,- pcg-random >= 0.1, primitive >= 0.6, random >= 1.1, cryptonite >= 0.24@@ -153,6 +166,10 @@ if impl(ghc < 7.10) buildable: False++ if flag(with-pcg)+ build-depends:+ pcg-random >= 0.1 other-modules: Benchmarks,