[Haskell-cafe] The Proliferation of List-Like Types

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Feb 21 17:44:29 EST 2008

On Thu, 2008-02-21 at 13:37 +0100, Johan Tibell wrote:

> I would be very happy if people didn't use the .Char8 versions of
> ByteString except for being able to write byte literals using pack. (I
> would be even happier if Haskell had byte literals.) If people start
> using ByteString in their library interfaces instead of String I'll be
> really miserable because I can't really use their libraries for
> writing applications that need to be internationalized because their
> libraries would be limited to ASCII.
> Data.ByteString and Data.ByteString.Char8 uses the same ByteString
> type so I can take some bytes in UTF-32 which I read from the network
> and use Data.ByteString.Char8 functions on them which will fail. I
> prefer that a type that represent characters is guarded by encode and
> decode functions. If that's not the case it's easy to mix data in
> different encodings by mistake when e.g. writing web applications
> which involve data in several different encodings.

The intention of allowing both views on one data type was to support the
myriad of mixed ascii / binary protocols with a minimum of fuss (there
are loads of network protocols like this). The intention was never to
support Unicode like String does. That's why we called it Char8, not

I do accept that because the Unicode version has not appeared yet people
have been tempted to use ByteString for text, which is not appropriate.


More information about the Haskell-Cafe mailing list