Why `isAlpha` can parse some non-alphabetic unicode characters like Chinese?

Refer to the doc Data.Char,is said:

isAlpha :: Char → Bool
Selects alphabetic Unicode characters (lower-case, upper-case and title-case letters, plus letters of caseless scripts and modifiers letters).

But when I test,it can parse non-alphabetic characters like Chinese.

isAlpha '你'
True

For my understanding,alphabetic characters is specified to the language which are Alphabetic Writing System,but Chinese is Logographic Writing System.Is the alphabetic means the characters which belong to a language having registered in the Unicode Standard?

(I’m sorry it seems like a linguistics question.

1 Like

That’s a great question instead. The documentation should be more specific about this.

1 Like

I think the documentation here needs some work - this function checks if something is a “letter”, and these use of the word “alphabetic” is somewhere between slightly unhelpful and outright incorrect. In colloquial English, it’s not uncommon to refer to a writing system as an alphabet, even if it’s not actually an alphabet, which is probably why this isn’t considered incorrect.

The important part of the documentation is the bit in parentheses, although it does require some familiarity with unicode to recognise what it is saying.

These are the unicode general character classes Ll, Lu, Lt, Lo and Lm (in that order). “你” belongs to the Lo class, which is why isAlpha '你' is true.

5 Likes

Thanks for your reply!

It helps a lot.

1 Like

Well,I want to submit issue to GHC’s team.But my account has been being pending approval.Could someone submit this question else?

Also,I have found a typo in Text.ParserCombinators.hs line 272:
Succeeds iff we are at the end of input

Thanks.

I have found a typo

Do you mean “iff”? That is a word that is short for “if and only if”.

my account has been being pending approval

@chreekat @bgamari

3 Likes

Ah,I’m sorry.I don’t know.:sob:

1 Like

That’s OK! No problem at all.

1 Like

Thanks for the ping! @WendaoLee 's account has been approved now.

3 Likes