on master help sign in
Fix benchmark build with "dev" flag for PrimArray
commit868fc9f996f47bb27b35442fea7465405914480d authorHarendra Kumar <harendra.kumar@gmail.com> dateSun 26 Jan 2020, 13:06 (7 years ago) parent52b11eb
2 files changed+9−3
benchmark/Streamly/Benchmark/Data/Prim/Array.hs+4−1 benchmark/Streamly/Benchmark/Data/Prim/ArrayOps.hs+5−2
benchmark/Streamly/Benchmark/Data/Prim/Array.hs+4−1
@@ -78,7 +78,10 @@ main =
7878 , benchIOSink "foldl'" Ops.pureFoldl'
7979 , benchIOSink "read" (S.drain . S.unfold A.read)
8080 , benchIOSink "toStreamRev" (S.drain . A.toStreamRev)
81−#ifdef DEVBUILD
81+#if 0
82+ -- PrimArray does not have a Foldable instance because it requires a
83+ -- Prim constraint. Though it should be possible to make an instance in
84+ -- the same way as we do in Memory.Array.
8285 , benchPureSink "foldable/foldl'" Ops.foldableFoldl'
8386 , benchPureSink "foldable/sum" Ops.foldableSum
8487#endif
benchmark/Streamly/Benchmark/Data/Prim/ArrayOps.hs+5−2
@@ -19,7 +19,7 @@ import Control.Monad.IO.Class (MonadIO)
1919import Prelude (Int, Bool, (+), ($), (==), (>), (.), Maybe(..), undefined)
2020import qualified Prelude as P
2121#ifdef DEVBUILD
22−import qualified Data.Foldable as F
22+-- import qualified Data.Foldable as F
2323#endif
2424
2525import qualified Streamly as S hiding (foldMapWith, runStream)
@@ -139,7 +139,10 @@ readInstance str =
139139pureFoldl' :: MonadIO m => Stream Int -> m Int
140140pureFoldl' = S.foldl' (+) 0 . S.unfold A.read
141141
142−#ifdef DEVBUILD
142+#if 0
143+-- PrimArray does not have a Foldable instance because it reuqires a Prim
144+-- constraint. Though it should be possible to make an instance in the same way
145+-- as we do in Memory.Array.
143146{-# INLINE foldableFoldl' #-}
144147foldableFoldl' :: Stream Int -> Int
145148foldableFoldl' = F.foldl' (+) 0