Skip to content

Fix use of Unicode characters in Identifiers - #105

Merged
BinderDavid merged 12 commits into
mainfrom
fix-4
Nov 23, 2026
Merged

BinderDavid merged 12 commits into
mainfrom
fix-4

Conversation

@BinderDavid

@BinderDavid BinderDavid commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #4

  • Replace ambiguous wording with precise references to the corresponding categories defined in the Unicode standard. E.g. Other Letter (Lo) instead of other letter.
  • Introduce uniIdchar and idchar nonterminals, as per the specification found in the GHC user guide.
  • Change definition of uniDigit. Note that after Fix #3 Exclude non-ASCII digits from decimal and hexit #67 we no longer use uniDigit in the syntax of numeric literals, only in the syntax of identifiers like foo5.
  • The definition of large = ascLarge | uniLarge (and similarly for small) is confusing, since ascLarge is a subset of uniLarge, so I have modified them.
  • ascLarge is now only used in the definition of cntrl, so I have moved it closer to there.
  • ascSmall is now only used in the FFI chapter, so I have moved it there.
  • Removed the remark that Haskell is ASCII biased, which is not really informative and arguably wrong depending on the user.

@BinderDavid BinderDavid added the feature: language report Concerns the language specification in the report label Oct 28, 2026

@adamgundry adamgundry left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the risk of pedantry, perhaps a consistent phrase like "any Unicode character (in the categories | with the property) ..." would make it clearer where we are carving up subsets of the space?

Comment thread chapters/02-lexical-structure.typ Resolved
Comment thread chapters/02-lexical-structure.typ Resolved
Comment thread chapters/02-lexical-structure.typ Resolved
Comment thread chapters/02-lexical-structure.typ Resolved
Comment thread chapters/02-lexical-structure.typ Resolved
Comment thread chapters/10-syntax-reference.typ Resolved
Comment thread chapters/10-syntax-reference.typ Resolved
Comment thread chapters/10-syntax-reference.typ Resolved
BinderDavid and others added 2 commits November 2, 2026 12:29
Co-authored-by: Adam Gundry <adam@well-typed.com>

@exaexa exaexa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me.

Vote +1 regardless of the ascDigit suggestion status.

Comment thread chapters/02-lexical-structure.typ Resolved

@endgame endgame left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote in favour.

Comment thread other/preface_revised.typ Resolved
@Superstar64

Superstar64 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

I'm kinda with hesitant identifiers being allowed to with "other letters". Is anyone familiar with the rationale of GHC allowing this?

@blamario

Copy link
Copy Markdown
Collaborator

@Superstar64

I'm kinda with hesitant identifiers being allowed to with "other letters". Is anyone familiar with the rationale of GHC allowing this?

The strict division of letters into lowercase and uppercase is a peculiarity of European scripts only. The Haskell report basically excludes the rest of the world's scripts from being used for identifiers: Arabic, Bengali, Chinese, etc. Haskell is already seen as elitist enough, there's no need to make it european-elitist.

@Superstar64

Copy link
Copy Markdown
Collaborator

@blamario, sorry that typo was in a bad spot. I meant why identifiers should be allowed to start with other letters. I support other letters being allowed in identifiers in general.

Is there a clear reason or history why other letters are effectively considered lower case rather then uncased (where "Modifier Letter (Lm)" and Non-Spacing Mark (Mn)" are in the proposal)?

@BinderDavid

Copy link
Copy Markdown
Collaborator Author

I think it is hard to reconstruct the historical reasoning, unless someone is able to find the old discussions. But I guess it is due to lowercase identifiers being more common in Haskell code and REPL sessions. In the type and constructor namespaces you probably have to then come up with a prefix like Mk奶茶 or so.

@Superstar64 Superstar64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I don't really like characters being allowed to start with other letters, but it's not a deal breaker for me. Parity with GHC is more important here. Approving.

@L0neGamer L0neGamer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; would it be worth putting examples of changes in what is and isn't accepted in the changelog?

@BinderDavid

Copy link
Copy Markdown
Collaborator Author

would it be worth putting examples of changes in what is and isn't accepted in the changelog?

I think we can do some editorial polishing of the Preface in the end and add additional examples. The Preface currently is mostly just a record of changes already merged.

@BinderDavid

Copy link
Copy Markdown
Collaborator Author

Including me (I cannot approve my own PR) I count 8 votes in favour. This is thereby accepted :)

@BinderDavid
BinderDavid merged commit 527d8c9 into main Nov 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: language report Concerns the language specification in the report process: accepted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change set of permissible Unicode letters in identifiers

8 participants