
Hi, What's the reason to have both isAlpha and isLetter? Looks like it's just an alias. I don't understand the purpose. Could you explain? Thanks

On Mon, Sep 10, 2012 at 3:09 PM, Stayvoid
What's the reason to have both isAlpha and isLetter?
Probably an alias for backward compatibility; isAlpha is C-style

Brandon Allbery wrote:
Probably an alias for backward compatibility; isAlpha is C-style
stuff, which was ASCII only, whereas isLetter is Unicode style.
Prelude Data.Char> all (\c -> isLetter c == isAlpha c) [minBound..maxBound] True Whew! You had me worried my code had unicode bugs. isAlpha == isLetter -- see shy jo

On Tue, Sep 11, 2012 at 1:49 AM, Joey Hess
Brandon Allbery wrote:
Probably an alias for backward compatibility; isAlpha is C-style
stuff, which was ASCII only, whereas isLetter is Unicode style. Prelude Data.Char> all (\c -> isLetter c == isAlpha c) [minBound..maxBound] True
Whew! You had me worried my code had unicode bugs.
I phrased it as "*alias* for backward compatibility" for a reason. It should be the same thing, but I expect older versions of Haskell used the older name because it was well established in the pre-Unicode era. (I couldn't say whether it was ever *native*; Haskell did not evolve in a vacuum, there are other languages in its background.) -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

On Tue, Sep 11, 2012 at 1:52 AM, Stayvoid
Probably an alias for backward compatibility; isAlpha is C-style
stuff, which was ASCII only, whereas isLetter is Unicode style. Both Haskell functions support non-ASCII chars. Does it refute your assumption?
No, it demonstrates I need to be more explicit for some people. I did not say isAlpha is ASCII-only, I said it was *created* in an ASCII-only time when "isAlpha" was (the Haskell version of) the common name for the operation. When the Char type became a Unicode codepoint instead of an ASCII character, isAlpha would naturally have been widened to match *and* the corresponding Unicode standard name was imported. Leaving it as is would have introduced bugs (of the sort that the GHC I/O subsystem had until ghc 6.12 or thenabouts, when it was finally made to use UTF8 instead of "ASCII"/ISO 8859-1). -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
participants (3)
-
Brandon Allbery
-
Joey Hess
-
Stayvoid