[Haskell-cafe] How to compose operations in streaming

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Wed Jun 3 13:27:55 UTC 2020


On Wed, Jun 03, 2020 at 07:38:51PM +0800, ☂Josh Chia (謝任中) wrote:
> The type of "SP.mapM_ putStrLn str" is IO (), so I don't think "SP.length_
> (SP.mapM_ putStrLn str)" type checks, unless I'm somehow misreading your
> code.

I meant `SP.mapM`.  This works:

    doit :: Stream (Of String) IO () -> IO ()
    doit str =
      SP.length_ (SP.mapM putStrLn str) >>= Prelude.print

`copy` is an intruiging solution though!


More information about the Haskell-Cafe mailing list