Gabriella439 / pipes

Compositional pipelines
BSD 3-Clause "New" or "Revised" License
488 stars 72 forks source link

Type of (~>) in Pipes Tutorial #117

Closed andrewthad closed 10 years ago

andrewthad commented 10 years ago

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 ()?

Gabriella439 commented 10 years ago

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.

andrewthad commented 10 years ago

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

Gabriella439 commented 10 years ago

Fixed by 560af74098f97044fc8fb2e9662f31fb5139c47e