[Haskell-cafe] Re: Abstraction leak

Andrew Coppin andrewcoppin at btinternet.com
Sun Jul 1 06:04:04 EDT 2007


apfelmus wrote:
> Andrew Coppin wrote:
>   
>>
>> It is enough. But given that the whole purpose of compression algorithms
>> is to squeeze data into the tiniest possible space, I wanted to avoid
>> having a size field. And mathematically it's perfectly possible to do...
>> I just can't find a convinient way to do it in Haskell. :-(
>>     
>
> Well, those 4 bytes won't kill you. But you can of course stop
> RLE-decoding as soon as this has read as many bytes as there are in the
> Huffman table. A systematic way to do this are parser combinators.
>   

Yeah... I'm fuzzy on how to do this.

I can write parsers to do the various stages, and I can run one parser 
on top of another. But how to you swap whole "stacks" of parsers when 
the top-most one reaches a given stage?



More information about the Haskell-Cafe mailing list