Opened 7 years ago

Closed 3 years ago

#5239 closed feature request (invalid)

Em-dash for "--" with UnicodeSyntax.

Reported by: Eelis- Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 7.0.3
Keywords: unicode syntax extension Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


It would be neat if the UnicodeSyntax extension supported the Unicode "—" EM DASH (U+2014) character as an alternative for the "--" single-line comment introduction character sequence.

One possible objection I can anticipate is that its use could be confusing when using a monospace font, but it seems unjust to let that hold back those of us who have liberated ourselves from monospace. :-)

Attachments (1)

mdash.patch (5.1 KB) - added by porges 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by igloo

Component: CompilerCompiler (Parser)
Milestone: 7.4.1

Changed 7 years ago by porges

Attachment: mdash.patch added


comment:2 Changed 7 years ago by porges

Status: newpatch

I have added a tentative patch. It works fine, but if UnicodeSyntax is disabled then the lexer gives an error upon encountering the mdashes... unexpected character '\n' or something. I thought that this was because of the 'Unicode fix' which transforms mdash into \x7, but Alex always complains about \n, not whatever it gets transformed into.

I'm not sure how to fix that, so I'm attaching it here in the hopes that someone else knows.

I also added some extra checking to the 'not in scope' error (in RnEnv.lhs) that suggests that users might want to enable UnicodeSyntax if compilation fails because an mdash isn't in scope. A further extension would be for this to happen when any UnicodeSyntax character turns up here. (This can't be seen at the moment because of the aforementioned issue but works fine if only this part is enabled.)

comment:3 Changed 7 years ago by porges

Figured out what was wrong with my patch. The '$mdash' declaration needs to be in the $symbol character class. After that change, all works as expected.

comment:4 Changed 6 years ago by igloo


comment:5 Changed 6 years ago by simonpj

difficulty: Unknown
Status: patchnew

Dear porges

Sorry that we've been playing dead on this.

We don't have an opinion either way, but it's not entirely clear to us that everyone would welcome such a change; eg they might want to use em-dash in an operator.

Could you initiate a thread on glasgow-haskell-users to see if other Unicode-aware folk actively want the change? If so, we'll apply it. A final patch would be useful; and it should include documentation in 7.3.1 of the user manual.



comment:6 Changed 6 years ago by igloo


comment:7 Changed 6 years ago by guest

I just want to speak out in support of this feature. I would prefer en-dashes over em-dashes though. (That would be consistent with the TeX convention of -- for en-dashes and --- for em-dashes.)

comment:8 Changed 4 years ago by thoughtpolice


Moving to 7.10.1.

comment:9 Changed 4 years ago by thoughtpolice


Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:10 Changed 3 years ago by thomie

Milestone: 7.12.1
Resolution: invalid
Status: newclosed

Please try to get support for this feature on one of the mailing lists first. See also: WorkingConventions/AddingFeatures.

Note: See TracTickets for help on using tickets.