[Haskell-cafe] How to compose operations in streaming

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Wed Jun 3 07:22:08 UTC 2020


On Wed, Jun 03, 2020 at 03:04:59PM +0800, ☂Josh Chia (謝任中) wrote:
> I want to putStrLn each element and then print the length of str
[...]
> doit :: Stream (Of String) IO () -> IO ()
> doit str =
>   do
>     SP.mapM_ putStrLn str
>     SP.length_ str >>= print

Isn't it

    SP.length_ (SP.mapM_ putStrLn str) >>= print


More information about the Haskell-Cafe mailing list