Haskell Platform proposal: Add case-insensitive and Haskell 98/2010 compliance

Ben Millwood haskell at benmachine.co.uk
Sun Jan 20 22:03:20 CET 2013

On Sun, Jan 20, 2013 at 08:21:32AM -0800, Mark Lentczner wrote:
>On Mon, Jan 14, 2013 at 9:43 AM, Gregory Collins <greg at gregorycollins.net>wrote:
>> The bytestring instances are what it's most often used for! The haddocks
>> warn about this issue. And: yes, we do want an ASCII case fold. If we
>> didn't, we'd be using Text.
>Note: case-insensitive provides ASCII case folding when used on ByteString.
>However, HTTP headers are in ISO-8859-1. Hence, using this for case folding
>HTTP headers isn't technically correct: It will fail for headers and other
>case-insensitive tokens with ISO-8859-1 accented characters., though
>admittedly in practice one doesn't see them.
>That bit of pedantry out of the way....

Interestingly, case-insensitive may well support this case by accident! 
The case-folding it uses is just that from Data.ByteString.Char8, which 
is Unicode code points 0-255, which includes (if I recall correctly) 
latin-1 as a subset.

Testing this may be misleading because Data.ByteString.Char8.putStrLn 
doesn't do anything clever, but you should find that packing, foldCase, 
unpacking does the right thing.

Of course, the documentation should be amended to state this if we are 
interested in making it a guarantee.

Ben Millwood

PS. Can I ask that people remove bm380 at srcf dot net from their CC 
lists in this thread? It's an artifact of when I accidentally replied 
from the wrong address and it's meaning I'm getting some stuff twice.

More information about the Libraries mailing list