[Haskell-cafe] ANNOUNCE: zlib and bzlib 0.4 releases

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Oct 23 11:30:56 EDT 2007

On Tue, 2007-10-23 at 16:34 +0200, Yitzchak Gale wrote:
> Duncan Coutts wrote:
> > I'm very happy to get feedback on the API, the documentation or of
> > course any bug reports.
> It would be nice if the API could be the same for all
> character and data codecs.

Hmm, though the inputs and outputs are different types in general. With
compression we're working with uninterpreted streams of bytes. For
character encoding/decoding we're converting between internal Unicode
representations and external representations as sequences of bytes.

That is, (de)compression does not fit into
encode :: [Word8] -> String
decode :: String -> [Word8]

If we parametrise over the input and output types we get something far
too general.

Also, from my point of view there's nothing wrong with giving
(de)compression a different function name from character encoding. In my
opinion it is easier to read:

content <- return . decode . decompress =<< readFile file


content <- return . decode . decode =<< readFile file

Where I mean to read a compressed unicode text file. Names are good! :-)

Am I missing something or just being curmudgeonly? :-)


More information about the Haskell-Cafe mailing list