ghci> let folds = Foldl.mapM_ print *> Foldl.generalize (liftA2 (,) Foldl.sum Foldl.mean) ghci> Streams.fromList [1..3::Double] >>= Foldl.impurely Streams.foldM_ folds 1.0 2.0 3.0 (6.0,2.0)Since 1.3.6.0
ghci> let folds = liftA3 (,,) Foldl.length Foldl.mean Foldl.maximum ghci> Streams.fromList [1..10::Double] >>= Foldl.purely Streams.fold_ folds is ghci> (10,5.5,Just 10.0)Since 1.3.6.0
ghci> is <- Streams.fromList [1, 2, 3::Int] ghci> (is', getSeed) <- Streams.inputFoldM (\x y -> return (x+y)) 0 is ghci> Streams.toList is' [1,2,3] ghci> getSeed 6
ghci> is <- Streams.fromList [1, 2, 3::Int] ghci> (os, getList) <- Streams.listOutputStream ghci> (os', getSeed) <- Streams.outputFoldM (\x y -> return (x+y)) 0 os ghci> Streams.connect is os' ghci> getList [1,2,3] ghci> getSeed 6
ghci> is <- Streams.unfoldM (n -> return $ if n < 3 then Just (n, n + 1) else Nothing) 0 ghci> Streams.toList is [0,1,2]