
Hi, One of my colleagues asked about using Unicode symbols in Haskell operators and I initially thought that this was supported. However, the code at the bottom of this message doesn't parse, reporting a lexical error on basically all of the funny characters of the form: Main.hs:1:5: error: lexical error at character '\65288' Character 65288 (0xff08) is punctuation [Ps] which I understand to mean it counts as a uniSymbol in the lexical structure described in the Haskell Report. https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2 Should this work? Not that I really want this specific example to work, but I'm interested to know why. Many thanks, David $ cat app/Main.hs foo (›’-’)› bar = False foo ‹(’-’‹) bar = False foo ∧(’-’)∧ bar = False foo ∨(’-’)∨ bar = False $ cat app/Main.hs | base64 # try and avoid mangling in email Zm9vIO+8iOKAuuKAmS3igJnvvInigLogYmFyID0gRmFsc2UKZm9vIOKAue+8iOKAmS3igJnigLnv vIkgYmFyID0gRmFsc2UKZm9vIOKIp++8iOKAmS3igJnvvIniiKcgYmFyID0gRmFsc2UKZm9vIOKI qO+8iOKAmS3igJnvvIniiKggYmFyID0gRmFsc2UK

foo (›’-’)› bar = False
Main.hs:1:5: error: lexical error at character '\65288'
Brackets. To see unicode operators in action, take a look at https://hackage.haskell.org/package/base-unicode-symbols and https://hackage.haskell.org/package/acme-flipping-tables Cheers.

On 13 July 2017 at 12:58, MarLinn
foo (›’-’)› bar = False
Main.hs:1:5: error: lexical error at character '\65288'
Brackets.
Yes, brackets, but why is this a problem? I found this code [1] in GHC which seems like it might be relevant. Is it? It seems to suggest that classes Pc, Pd, Po, Sm, Sc, Sk and So are allowed in infix names, but Ps, Pe, Pi and Pf are not. Am I reading that right? [1] https://github.com/ghc/ghc/blob/49012ebc9ed44a0b1f8de3781e15c8115d3074f8/com... Cheers, David

I think MarLinn was highlighting that this line:
foo ‹(’-’‹) bar = False
Should read like this:
foo ‹(’-’)‹ bar = False
On Fri, Jul 14, 2017 at 1:03 AM, David Turner wrote: On 13 July 2017 at 12:58, MarLinn foo (›’-’)› bar = False Main.hs:1:5: error: lexical error at character '\65288' Brackets. Yes, brackets, but why is this a problem? I found this code [1] in GHC which seems like it might be relevant. Is it?
It seems to suggest that classes Pc, Pd, Po, Sm, Sc, Sk and So are allowed
in infix names, but Ps, Pe, Pi and Pf are not. Am I reading that right? [1] https://github.com/ghc/ghc/blob/49012ebc9ed44a0b1f8de3781e15c8
115d3074f8/compiler/parser/Lexer.x#L2013 Cheers, David _______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

And also:
foo (›’-’)› bar = False
should be
foo ›(’-’)› bar = False
I'd suggest ensuring your code compiles without the unicode first, before
trying to add the unicode symbols, so you can be sure it's the unicode
causing the problem.
On Fri, Jul 14, 2017 at 1:17 AM, David Turner wrote: On 13 July 2017 at 16:13, Clinton Mead I think MarLinn was highlighting that this line: foo ‹(’-’‹) bar = False Should read like this: foo ‹(’-’)‹ bar = False That doesn't seem to help, unfortunately. It says: Main.hs:1:5: error: lexical error at character '\8249'

On 13 July 2017 at 16:20, Clinton Mead
And also:
foo (›’-’)› bar = False
should be
foo ›(’-’)› bar = False
I'd suggest ensuring your code compiles without the unicode first, before trying to add the unicode symbols, so you can be sure it's the unicode causing the problem.
It does. This is fine:
foo ?!?!?!? bar = False
It's the Unicode punctuation that isn't. Note that the things that look like parentheses aren't ASCII parentheses, they're U+FF08 FULLWIDTH LEFT PARENTHESIS and U+FF09 FULLWIDTH RIGHT PARENTHESIS, which are in classes Ps and Pe respectively, and the code I linked to earlier seems to dislike those classes. Cheers, David
participants (3)
-
Clinton Mead
-
David Turner
-
MarLinn