ghci> (os, flush) <- Streams.listOutputStream :: IO (OutputStream Int, IO [Int]) ghci> Streams.writeList [1, 2] os ghci> flush [1, 2] ghci> Streams.writeList [3, 4] os ghci> flush [3, 4]
ghci> fromList [1..14::Int] >>= chunkListWith (x n -> n>=4) >>= toList [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14]] ghci> fromList [a..z] >>= chunkListWith (x n -> n>=4 && x elem "aeiouy") >>= toList ["abcde","fghi","jklmno","pqrstu","vwxy","z"]Since: 1.3.3.0.
ghci> Streams.fromList [[1,2,3::Int], [4,5,6]] >>= Streams.concatLists >>= Streams.toList [1,2,3,4,5,6]
ghci> is <- Streams.fromList [1, 2] ghci> replicateM 3 (Streams.read is) [Just 1, Just 2, Nothing]
ghci> import Control.Applicative ghci> (connect $ fromList ["a", "b", "c"]) >>= outputToList ["a","b","c"]
ghci> is <- Streams.fromList [1, 2] ghci> Streams.toList is [1, 2]
ghci> os <- Streams.unlines Streams.stdout >>= Streams.contramap (S.pack . show) :: IO (OutputStream Int) ghci> Streams.writeList [1, 2] os 1 2 ghci> Streams.writeList [3, 4] os 3 4