Proxys in the wild

18 views
Skip to first unread message

Tom Ellis

unread,
Jul 28, 2017, 11:45:26 AM7/28/17
to Haskell Pipes
Inspired by this discussion

https://www.reddit.com/r/haskell/comments/6pzwnb/streaming_programs_without_laziness_a_short_primer/

I began to wonder: what are the `Proxy`s that occur in the wild that are not
`Pipe`s? That is, when in practice do we actually need to send data back
upstream?

Can anyone provide some examples?

Thanks,

Tom

David McBride

unread,
Jul 28, 2017, 11:53:09 AM7/28/17
to haskel...@googlegroups.com, Tom Ellis
The most common scenario is when it is not enough to just request a
chunk, but you have to make the request with some metadata.

For example you might have a producer that would like to know how many
bytes it should read from a file for every chunk. That would
correspond to Server Int ByteString in the pipes library.
> --
> 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-pipe...@googlegroups.com.
> To post to this group, send email to haskel...@googlegroups.com.

Tom Ellis

unread,
Jul 28, 2017, 2:49:46 PM7/28/17
to Haskell Pipes
On Fri, Jul 28, 2017 at 12:30:15PM -0400, Ben Gamari wrote:
> Tom Ellis <tom-lists-hask...@jaguarpaw.co.uk> writes:
> > Inspired by this discussion
> >
> > https://www.reddit.com/r/haskell/comments/6pzwnb/streaming_programs_without_laziness_a_short_primer/
> >
> > I began to wonder: what are the `Proxy`s that occur in the wild that are not
> > `Pipe`s? That is, when in practice do we actually need to send data back
> > upstream?
>
> I use Proxy's bidirectionality in my b-tree library [1]: Blocks to be
> written to disk are passed downstream, while the disk offset at which
> the data was written is passed back upstream. This makes for a very
> clean separation between the disk backend and the book-keeping involved
> in building the data structure.

Does upstream need the offset in order to send the next block downstream?
IF not couldn't it be a unidirectional pipe?
Reply all
Reply to author
Forward
0 new messages