[web-devel] Data.Word8 (word8 library)

Johan Tibell johan.tibell at gmail.com
Thu Sep 20 11:02:08 CEST 2012

On Thu, Sep 20, 2012 at 10:41 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> Why do people use Data.ByteString.Char8? I guess that there are two
> reasons:
> - There are no standard utility functions for Word8 such as "isUpper"
> - Numeric literal (e.g 72 for 'H') is not readable

The Char8 module was added so that it's easier to work with protocols
that mix binary and ASCII data, such as HTTP.

Note that Word8 is represented using a full machine word, just like
Char, so you're unlikely to get any performance improvements from
Word8 in this case (unless GHC fails to simplify e.g. calls to 'ord'
and 'chr' in places).

-- Johan

More information about the web-devel mailing list