Proxys in the wild

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Proxys in the wild

Tom Ellis-4
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

--



Reply | Threaded
Open this post in threaded view
|

Re: Proxys in the wild

David McBride
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.

On Fri, Jul 28, 2017 at 11:45 AM, Tom Ellis
<[hidden email]> wrote:

> 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
>
> --
>
>
>

--



Reply | Threaded
Open this post in threaded view
|

Re: Proxys in the wild

Tom Ellis-4
In reply to this post by Tom Ellis-4
On Fri, Jul 28, 2017 at 12:30:15PM -0400, Ben Gamari wrote:

> Tom Ellis <[hidden email]> 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?

--