on master help sign in
Use foldMany1 in chunksOf instead of foldMany
b6a0752Harendra Kumar
benchmark/Streamly/Benchmark/FileSystem/Handle/Read.hs+2−2
@@ -49,7 +49,7 @@ import Prelude hiding (last, length)
49import Streamly.Benchmark.Common.Handle
49import Streamly.Benchmark.Common.Handle
50
50
51#ifdef INSPECTION
51#ifdef INSPECTION
52−import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), GroupState)
52+import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), FoldMany1)
53
53
54import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
54import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
55import qualified Streamly.Internal.Data.Stream.StreamD as D
55import qualified Streamly.Internal.Data.Stream.StreamD as D
@@ -336,7 +336,7 @@ chunksOf n inh =
336#ifdef INSPECTION
336#ifdef INSPECTION
337inspect $ hasNoTypeClasses 'chunksOf
337inspect $ hasNoTypeClasses 'chunksOf
338inspect $ 'chunksOf `hasNoType` ''Step
338inspect $ 'chunksOf `hasNoType` ''Step
339−inspect $ 'chunksOf `hasNoType` ''GroupState
339+inspect $ 'chunksOf `hasNoType` ''FoldMany1
340inspect $ 'chunksOf `hasNoType` ''AT.ArrayUnsafe -- AT.writeNUnsafe
340inspect $ 'chunksOf `hasNoType` ''AT.ArrayUnsafe -- AT.writeNUnsafe
341inspect $ 'chunksOf `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
341inspect $ 'chunksOf `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
342inspect $ 'chunksOf `hasNoType` ''MA.ReadUState -- FH.read/A.read
342inspect $ 'chunksOf `hasNoType` ''MA.ReadUState -- FH.read/A.read
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+2−2
@@ -112,7 +112,7 @@ inspect $ hasNoTypeClasses 'readFromBytesNull
112inspect $ 'readFromBytesNull `hasNoType` ''Step
112inspect $ 'readFromBytesNull `hasNoType` ''Step
113inspect $ 'readFromBytesNull `hasNoType` ''MAS.SpliceState
113inspect $ 'readFromBytesNull `hasNoType` ''MAS.SpliceState
114inspect $ 'readFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
114inspect $ 'readFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
115−inspect $ 'readFromBytesNull `hasNoType` ''D.GroupState
115+inspect $ 'readFromBytesNull `hasNoType` ''D.FoldMany1
116#endif
116#endif
117
117
118-- | Send the file contents ('defaultChunkSize') to /dev/null
118-- | Send the file contents ('defaultChunkSize') to /dev/null
@@ -126,7 +126,7 @@ inspect $ hasNoTypeClasses 'readWithBufferOfFromBytesNull
126inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''Step
126inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''Step
127inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''MAS.SpliceState
127inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''MAS.SpliceState
128inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
128inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
129−inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''D.GroupState
129+inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''D.FoldMany1
130#endif
130#endif
131
131
132-- | Send the chunk content ('defaultChunkSize') to /dev/null
132-- | Send the chunk content ('defaultChunkSize') to /dev/null
src/Streamly/Internal/Data/Stream/StreamD/Type.hs+2−1
@@ -78,6 +78,7 @@ module Streamly.Internal.Data.Stream.StreamD.Type
78 , concatMap
78 , concatMap
79 , concatMapM
79 , concatMapM
80 , FoldMany (..) -- for inspection testing
80 , FoldMany (..) -- for inspection testing
81+ , FoldMany1 (..)
81 , foldMany
82 , foldMany
82 , foldMany1
83 , foldMany1
83 , groupsOf2
84 , groupsOf2
@@ -904,7 +905,7 @@ foldMany1 (Fold fstep initial extract) (Stream step state) =
904
905
905{-# INLINE chunksOf #-}
906{-# INLINE chunksOf #-}
906chunksOf :: Monad m => Int -> Fold m a b -> Stream m a -> Stream m b
907chunksOf :: Monad m => Int -> Fold m a b -> Stream m a -> Stream m b
907−chunksOf n f = foldMany (FL.takeLE n f)
908+chunksOf n f = foldMany1 (FL.takeLE n f)
908
909
909data GroupState2 s fs
910data GroupState2 s fs
910 = GroupStart2 s
911 = GroupStart2 s