Ticket #1506 (closed feature request: wontfix)

Opened 6 years ago

Last modified 5 years ago

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:

Description

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

Changed 6 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. < http://www.unicode.org/unicode/reports/tr21/> 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! ("σ" /= "ς", "σ" == "Σ", "σ" == "ς")

Changed 6 years ago by Isaac Dupree

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

Changed 6 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 ( http://www.haskell.org/haskellwiki/Library_submissions) for this; looking at algorithms from the Unicode guys sounds like a good way to go.

Changed 5 years ago by PHO

  • cc pho@… added

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to wontfix

Please follow the library submissions process for this:  http://www.haskell.org/haskellwiki/Library_submissions

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

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