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

Thanks Renzo to take the time to comment on this.

There is also the third alternative from Neil Mitchell also discussed by 
Brent Yorgey:

http://neilmitchell.blogspot.be/2008/04/optional-parameters-in-haskell.html
http://byorgey.wordpress.com/2010/04/03/haskell-anti-pattern-incremental-ad-hoc-parameter-abstraction/

My feeling is that the current situation is better for the code writer but 
worse for the code reader.

Personally I believe the code reader should always win ;-)
 

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

For information, the `network` library uses this message:

-- Considering hardware and network realities, the maximum number of bytes to-- 
receive should be a small power of 2, e.g., 4096.



 

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