`Pipes.ByteString.concatMap` just does the dumb thing and applies
`Data.ByteString.concatMap` to each chunk.  I don't know of a solution that
works in constant space, mainly because the user can inject an arbitrarily
long string as the output for a single character.

On Mar 10, 2014 7:55 AM, "Michael Thompson" <[email protected]>
wrote:
>
>
> > I have found the second Int params of `fromSocket` to be
> > quite confusing (as it is set to the same value as the port)
>
> It was a little jarring to me too, since
> without it the first several finger exercises
> in Michael S's tutorial would have had an
> almost musical symmetry and transparency
> in the pipes versions. (I changed them all
> to the default 4096 in my ireplicas).
>
> Another possibility would be a distinction
> like the one in `bytestring` and `pipes-bytestring`
> between `fromHandle` and `hGetSome`.
>
> I came around to Renzo C's decision
> when I thought about it together with
> the remark made in `pipes-bytestring`
>
> > Note that functions in this
> > library are designed to operate
> > on streams that are insensitive
> > to chunk boundaries. This means
> > that they may freely split chunks
> > into smaller chunks and discard
> > empty chunks. However, they will
> > never concatenate chunks in order
> > to provide strict upper bounds on
> > memory usage.
>
> That you control size at the source
> sort of emphasizes that you don't
> have to elsewhere.
>
> Notice though that since Snoyman's
> the 'doubler' uses `PB.concatMap` it
> has already hit on an exception to
> this rule!  I fretted about this
> in connection with `Pipes.Text.concatMap`
> but how do you control something like
>
>     Text.concatMap (\case 'x' -> T.replicate (10 ^ 1000) 'x'; z -> z)
>
> --
> 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 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