data X has no inhabitants.  () has exactly one inhabitant, which is ().

This means that you can constuict a (), but you cannot construct an X.

Inn practice with pipes that means that if a part of the Pipe type is
set to (), you can use yield () in your code.  But you cannot yield
(??? :: X) because X has no constructor.

By the time you've connected a producer to a consumer you have a full
Effect type, it should not be sending items up or down stream, () or
otherwise, so it blocks off both of those variables in the Effect type
to force your code to adhere to that on the type level.

On Tue, May 9, 2017 at 11:06 AM, Yan Huang <yhu...@cs.umd.edu> wrote:
> In the Appendix section of the tutorial
> (https://hackage.haskell.org/package/pipes-4.3.3/docs/Pipes-Tutorial.html),
> it defines an inhabited "data X" to mask the backward flow of the "Proxy"
> type. It seems that the null type "()" is also used for the same purpose,
> while the choice of X and () as a dummy type looks arbitrary. Are there any
> differences or am I missing something?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Haskell Pipes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to haskell-pipes+unsubscr...@googlegroups.com.
> To post to this group, send email to haskell-pipes@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to