on master help sign in
add singleton stream case
6c5da1cHarendra Kumar
test/Prop.hs+5−1
@@ -310,7 +310,11 @@ main = hspec $ do
310 `shouldReturn` (take 100 $ iterate (+ 1) 0)
310 `shouldReturn` (take 100 $ iterate (+ 1) 0)
311
311
312 let folded :: Streaming t => [a] -> t IO a
312 let folded :: Streaming t => [a] -> t IO a
313− folded = adapt . serially . (foldMapWith (<>) return)
313+ folded = adapt . serially . (\xs ->
314+ case xs of
315+ [x] -> return x -- singleton stream case
316+ _ -> foldMapWith (<>) return xs
317+ )
314 describe "Functor operations" $ do
318 describe "Functor operations" $ do
315 functorOps A.each "serially" serially (==)
319 functorOps A.each "serially" serially (==)
316 functorOps folded "serially folded" serially (==)
320 functorOps folded "serially folded" serially (==)