Support case-insensitive comparisons #9
Replies: 3 comments
-
|
In my use case - email and in particular header and parameter names - case-insensitive comparison is essential, and case preservation of values to be compared case-insensitively is desirable. The case-insensitive library meets these requirements. I take your point about |
Beta Was this translation helpful? Give feedback.
-
|
And y'know... I'll just leave this here :) |
Beta Was this translation helpful? Give feedback.
-
|
Heh, fair point about lazy ByteString, though I don't have to like that either! I suppose it's no big deal to add an instance. That dependency is pretty stable, in Stackage, no major transitive dependencies, and the I do also want to add some Equivalences, but we can do both. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Previously brought up by @frasertweedale here, where the request was to add a
FoldCaseinstance (I presume from the case-insensitive package).I'm inclined to discourage use of the
CItype; it bothers me a lot thatCIhas a field that==doesn't consider in its equality test, I think it's an abuse ofEq. As the docs say:And I think that going against this expectation can lead us to unhappy places.
I was considering adding another package called
ascii-subset, whose purpose would be to provide types like "case-insensitive character". (I can think of a handful of ways to write this: to define a new type for each ASCII subset we care to consider, to define a 128-constructor GADT with some phantom type parameters that allow you to narrow the type, or to define various smaller types likeControlCharacter,Digit,CapitalLetter,SmallLetteretc. and then build up various ASCII subsets out of those. But, setting aside these details for the moment...) What do you think, would having "case-insensitive char" and "case-insensitive string" types be helpful, or is there a particular need for theCIapproach that preserves the original case?Beta Was this translation helpful? Give feedback.
All reactions