on master help sign in
Fix smapM
a78e05bHarendra Kumar
src/Streamly/Internal/Data/Stream/IsStream.hs+5−3
@@ -2598,13 +2598,15 @@ smapM :: (IsStream t, Monad m) =>
2598 -> t m b
2598 -> t m b
2599smapM step initial stream =
2599smapM step initial stream =
2600 -- XXX implement this directly instead of using scanlM'
2600 -- XXX implement this directly instead of using scanlM'
2601− -- Once we have scanlM' with monadic initial we can use this code
2601+ -- Once we have postscanlM' with monadic initial we can use this code
2602− -- let r = scanlM'
2602+ -- let r = postscanlM'
2603 -- (\(s, _) a -> step s a)
2603 -- (\(s, _) a -> step s a)
2604 -- (fmap (,undefined) initial)
2604 -- (fmap (,undefined) initial)
2605 -- stream
2605 -- stream
2606 let r = concatMap
2606 let r = concatMap
2607+ (\s0 ->
2607− (\s0 -> scanlM' (\(s, _) a -> step s a) (s0, undefined) stream)
2608+ postscanlM' (\(s, _) a -> step s a) (s0, undefined) stream
2609+ )
2608 (yieldM initial)
2610 (yieldM initial)
2609 in Serial.map snd r
2611 in Serial.map snd r
2610
2612