ghci> Streams.fromList ["the", "quick", "brown", "fox"] >>= Streams.filter (/= "brown") >>= Streams.toList ["the","quick","fox"]
ghci> Streams.fromList ["the", "quick", "brown", "fox"] >>= Streams.filterM (return . (/= "brown")) >>= Streams.toList ["the","quick","fox"]
ghci> import qualified Data.ByteString.Char8 as S ghci> os1 <- Streams.stdout >>= Streams.'System.IO.Streams.unlines ghci> os2 <- os1 >>= Streams.contramap (S.pack . show) >>= Streams.filterOutput even ghci> Streams.write (Just 3) os2 ghci> Streams.write (Just 4) os2 4
ghci> let check a = putStrLn a ("Allow " ++ show a ++ "?") >> readLn :: IO Bool
ghci> import qualified Data.ByteString.Char8 as S
ghci> os1 <- Streams.unlines Streams.stdout
ghci> os2 <- os1 >>= Streams.contramap (S.pack . show) >>= Streams.filterOutputM check
ghci> Streams.write (Just 3) os2
Allow 3?
False<Enter>
ghci> Streams.write (Just 4) os2
Allow 4?
True<Enter>
4