[Haskell-cafe] Re: Abstraction leak
andrewcoppin at btinternet.com
Sun Jul 1 05:27:39 EDT 2007
> Am I missing something or why wouldn't
> encode, decode :: String -> String
> encode = encodeRLE . encodeHuffman
> decode = decodeHuffman . decodeRLE
> do the job? This is probably what Andrew intends to do in his Java
> version. Note that this not only RLE-encodes the Huffman table but also
> (needlessly) the data stream. In case you only want to RLE the table, a
> simple Word32 field tracking the size of the Huffman table should be enough.
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. :-(
More information about the Haskell-Cafe