[Haskell-cafe] Attoparsec concatenating combinator

Gregory Collins greg at gregorycollins.net
Fri Jun 3 16:42:48 CEST 2011


On Fri, Jun 3, 2011 at 11:52 AM, Yitzchak Gale <gale at sefer.org> wrote:
> Bryan O'Sullivan wrote:
>> I'd like a no-copy combinator for the same reasons, but I think it's
>> impossible to do without some low-level support.
>
> I wrote:
>>> ...does the internal representation easily admit such a combinator?
>
>> Not very easily. Internally, attoparsec maintains just three pieces of data
>> for its state... If
>> there was a "bytes consumed" counter, it would be possible to write a
>> "try"-like combinator
>
> I was thinking of even lower level: allocating a moderate chunk of
> memory and writing the results directly into it consecutively as a
> special case.

The blaze-builder might work for this also, this is exactly the
problem it's designed for.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the Haskell-Cafe mailing list