Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#1506 closed feature request (wontfix)

Case-insensitive char/string comparison

Reported by: Eelis Owned by:
Priority: normal Milestone: Not GHC
Component: libraries/base Version: 6.6.1
Keywords: Cc: pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:


Data.Char provides functions to convert case, but does not provide a function to perform case-insensitive char/string comparison. Note that such functionality cannot be obtained by simply comparing for equality after performing toUpper/toLower, because some languages have things like multiple lowercase characters corresponding to the same uppercase character.

For example, in Greek, converting either σ or ς to uppercase yields Σ, while the inverse always yields σ. Consequently, the convert-all-to-uppercase approach would produce a false positive when comparing σ to ς, and the convert-all-to-lowercase approach would produce a false negative when comparing Σ to ς.

Change History (7)

comment:1 Changed 7 years ago by Isaac Dupree

Would/should a "case-insensitive compare" distinguish σ and ς? I think we need a standard Unicode-recommendation reference in order to determine what should be implemented. <> might be a good starting-point; the recommendation seems to be "normalize it (in a more sophisticated way than just toUpper or toLower), then compare". If not done that way, c.i. equality is non-transitive! ("σ" /= "ς", "σ" == "Σ", "σ" == "ς")

comment:2 Changed 7 years ago by Isaac Dupree

that last equation should read "Σ" == "ς"

comment:3 Changed 7 years ago by igloo

  • Component changed from Compiler to libraries/base
  • Milestone set to Not GHC

It would be great if someone could make a proposal ( for this; looking at algorithms from the Unicode guys sounds like a good way to go.

comment:4 Changed 6 years ago by PHO

  • Cc pho@… added

comment:5 Changed 6 years ago by igloo

  • Resolution set to wontfix
  • Status changed from new to closed

Please follow the library submissions process for this:

comment:6 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:7 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.