Thanks, David! Your explanation helps. But one more question appears,

Why isn't the Producer defined as follows
      type Producer b = Proxy X () *X* b
(where both ends of the upstream are assured to be blocked)
or defined as
      type Producer b = Proxy X *X* *X* b
(where it is guaranteed that the producer can't take in anything from the
source of the downstream)?


On Tue, May 9, 2017 at 11:30 AM, David McBride <[email protected]> wrote:

> 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 <[email protected]> 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 [email protected].
> > To post to this group, send email to [email protected].
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Haskell Pipes" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/haskell-pipes/gLSIj_E9RSc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
>

-- 
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 [email protected].
To post to this group, send email to [email protected].

Reply via email to