On Monday, March 10, 2014 11:05:56 AM UTC-4, Gabriel Gonzalez wrote:
>
> `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.
>
I notice that Data.ByteString.Lazy and Data.Text.Lazy don't have this
trouble,
since `concatMap` takes a function to lazy ByteStrings/Texts
https://github.com/bos/text/blob/master/Data/Text/Lazy.hs#L782
http://hackage.haskell.org/package/bytestring-0.10.4.0/docs/src/Data-ByteString-Lazy.html#concatMap
So viewing Pipes.ByteString and Pipes.Text as replacements for lazy
bytestring and text, `concatMap` would take a function to Producers,
and come close to the signature inferred for
concatMap f = P.map B.unpack >-> P.concat >-> for cat f
This would make `PB.concatMap (\c -> B.pack [c,c])` in Snoyman's doubler
generate a tide of microchunks of course, so maybe it's just as well as it
is.
--
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].