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

Bas van Dijk v.dijk.bas at gmail.com
Thu Sep 20 17:57:08 CEST 2012


On 20 September 2012 16:47, Gregory Collins <greg at gregorycollins.net> wrote:
> We only call toLower explicitly in one place in snap-server, but where this
> would be nice to fix is for HTTP headers, where I think we are all using
> case-insensitive (which just calls "map toLower"). Probably we should send
> Bas a patch to optimize the FoldCase instance for ByteString.

Note that case-insensitive already uses an optimized toLower:

instance FoldCase B.ByteString where foldCase = B.map toLower

toLower :: Word8 -> Word8
toLower w
  |  65 <= w && w <=  90 ||
    192 <= w && w <= 214 ||
    216 <= w && w <= 222 = w + 32
  | otherwise            = w

This was contributed by Kazu a month ago and modified by me to support
all characters in the Latin1 supplement:

https://github.com/basvandijk/case-insensitive/pull/6

Cheers,

Bas



More information about the web-devel mailing list