On Mon, Mar 10, 2014 at 4:30 AM, Pierre R <[email protected]> wrote:
> Thanks !
>
> I have found the second Int params of `fromSocket` to be quite confusing (as
> it is set to the same value as the port)
>
> https://github.com/michaelt/pipes-network-tcp-examples/blob/master/server_toupper.hs#L7
>
> This makes me wonder why `fromSocket` does not provide sensible defaults in
> the first place. I mean the comment "Try using 4096 if you don't care"
> sounds kind of awkward to me.

The related issue is being discussed here:
https://github.com/k0001/pipes-network/issues/20#issuecomment-37095131

I'm leaning towards thinking that there's nothing to change: I'd like
to offer users the possibility of specifying how many bytes they want
to receive as it can affect the performance of their programs. Besides
the article Kyle pointed out on that issue, for example, if you are
writing a program that will run in a fast network and you know that
your packets are 32K in size, you can go ahead and request that number
of bytes in order to reduce the number of `await`/`yield` steps your
program must execute before being able to process a full packet. The
alternatives are to provide have `fromSocket` take a `Maybe` where
`Nothing` stands for `Just 4096` (or some other “appropriate”
default), or to add another function that doesn't take this optional
parameter at all and picks some “appropriate” default. I'd prefer the
latter approach, but the problem is that, for consistency, now we have
to duplicate all the other functions taking parameters similar to
those of `fromSocket`, which will add a lot of noise to the API. I'm
open to suggestions, but until now I think that always specifying this
parameter is the cleanest solution. Maybe the documentation saying
“Try using 4096 if you don't care” could be improved.


> On Monday, March 10, 2014 3:31:24 AM UTC+1, Michael Thompson wrote:
>>
>> It's nothing to write home, or even to the list, about -- but not having
>> used
>> `pipes-network`, I rewrote the super-elementary examples in Michael S's
>> post http://www.yesodweb.com/blog/2014/03/network-conduit-async in
>> pipe-ese.
>> I think partly I just wanted to see if the pipes versions would seem
>> handsomer and more intelligible.

Thanks for these examples Michael, they are quite helpful. I think
I'll add a wiki page in `pipes-network` titled “Examples” so that I
can point to your examples and others that might come up in the
future.


Regards,

Renzo Carbonara.

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