Gabriella439 / pipes

Compositional pipelines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type of (~>) in Pipes Tutorial

andrewthad opened this issue · comments

In the pipes tutorial, when the ~> (the into function) is introduced, the type signature is given as:

(~>) :: Monad m
  => (a -> Producer b m r)
  -> (b -> Producer c m r)
  -> (a -> Producer c m r)

However, the second specialized type of ~> given in the haddocks for the Pipes page (where it lists a total of four specialized signatures) is:

(~>) :: Monad m => (a -> Producer b m r) -> (b -> Producer   c m ()) -> (a -> Producer   c m r)

Is the Producer in the second argument supposed to be parameterized by type r or by ()?

Oops, that's a typo in the tutorial. The haddocks are correct. The symmetric type signature from the tutorial should have been:

(~>) :: Monad m
     => (a -> Producer b m ())
     -> (b -> Producer c m ())
     -> (a -> Producer c m ())

... which just a specialized version of the form in the haddocks.

Ah, thanks for the clarification. That makes more sense.

Fixed by 560af74