system-random-effect 0.4.0 → 0.4.1
raw patch · 2 files changed
+26/−5 lines, 2 filesdep ~vector-algorithms
Dependency ranges changed: vector-algorithms
Files
- bench/Bench.hs +23/−2
- system-random-effect.cabal +3/−3
bench/Bench.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE OverlappingInstances #-} module Main ( main ) where +import Data.Bits+import Data.List import Data.Word import Control.Eff@@ -31,10 +34,28 @@ return (x `rem` range + a) {-# NOINLINE fastIntDist #-} -instance NFData a => Benchmarkable (Eff (State Random :> ()) a) where+instance (NFData a, Num a) => Benchmarkable (Eff (State Random :> ()) a) where run eff n = do let res = Control.Eff.run $ runRandomState (mkRandom 0) $ do- last <$> replicateM n eff+ sum <$> replicateM n eff++ _ <- evaluate (rnf res)+ return ()++b2i :: Bool -> Int+b2i True = 1+b2i False = 0++i2b :: Int -> Bool+i2b = (/= 0)++bxor :: Bool -> Bool -> Bool+bxor x y = i2b (b2i x `xor` b2i y)++instance Benchmarkable (Eff (State Random :> ()) [Bool]) where+ run eff n = do+ let res = Control.Eff.run $ runRandomState (mkRandom 0) $ do+ foldl' bxor False . map (foldl' bxor False) <$> replicateM n eff _ <- evaluate (rnf res) return ()
system-random-effect.cabal view
@@ -1,12 +1,12 @@ name: system-random-effect-version: 0.4.0+version: 0.4.1 synopsis: Random number generation for extensible effects. homepage: https://github.com/wowus/system-random-effect license: BSD3 license-file: LICENSE author: Clark Gaebel maintainer: cgaebel@uwaterloo.ca-category: System+category: System, Effect build-type: Simple cabal-version: >=1.10 @@ -21,7 +21,7 @@ , mersenne-random-pure64 == 0.2.* , statistics == 0.10.* , vector == 0.10.*- , vector-algorithms == 0.5.*+ , vector-algorithms == 0.6.* , primitive == 0.5.* , crypto-api == 0.12.* , bytestring == 0.10.*