on master help sign in
Fix benchmark build with "dev" flag for PrimArray
868fc9fHarendra Kumar
benchmark/Streamly/Benchmark/Data/Prim/Array.hs+4−1
@@ -78,7 +78,10 @@ main =
78 , benchIOSink "foldl'" Ops.pureFoldl'
78 , benchIOSink "foldl'" Ops.pureFoldl'
79 , benchIOSink "read" (S.drain . S.unfold A.read)
79 , benchIOSink "read" (S.drain . S.unfold A.read)
80 , benchIOSink "toStreamRev" (S.drain . A.toStreamRev)
80 , 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.
82 , benchPureSink "foldable/foldl'" Ops.foldableFoldl'
85 , benchPureSink "foldable/foldl'" Ops.foldableFoldl'
83 , benchPureSink "foldable/sum" Ops.foldableSum
86 , benchPureSink "foldable/sum" Ops.foldableSum
84#endif
87#endif
benchmark/Streamly/Benchmark/Data/Prim/ArrayOps.hs+5−2
@@ -19,7 +19,7 @@ import Control.Monad.IO.Class (MonadIO)
19import Prelude (Int, Bool, (+), ($), (==), (>), (.), Maybe(..), undefined)
19import Prelude (Int, Bool, (+), ($), (==), (>), (.), Maybe(..), undefined)
20import qualified Prelude as P
20import qualified Prelude as P
21#ifdef DEVBUILD
21#ifdef DEVBUILD
22−import qualified Data.Foldable as F
22+-- import qualified Data.Foldable as F
23#endif
23#endif
24
24
25import qualified Streamly as S hiding (foldMapWith, runStream)
25import qualified Streamly as S hiding (foldMapWith, runStream)
@@ -139,7 +139,10 @@ readInstance str =
139pureFoldl' :: MonadIO m => Stream Int -> m Int
139pureFoldl' :: MonadIO m => Stream Int -> m Int
140pureFoldl' = S.foldl' (+) 0 . S.unfold A.read
140pureFoldl' = S.foldl' (+) 0 . S.unfold A.read
141
141
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.
143{-# INLINE foldableFoldl' #-}
146{-# INLINE foldableFoldl' #-}
144foldableFoldl' :: Stream Int -> Int
147foldableFoldl' :: Stream Int -> Int
145foldableFoldl' = F.foldl' (+) 0
148foldableFoldl' = F.foldl' (+) 0