Skip to content

Unicode 8.0 and later characters are invariably lexical errors

I've tried a few added alphabet characters and emojis from various Unicode versions. It seems like Unicode 7.0 works fine. It seems like characters from Unicode 8.0 and later are lexical errors.

For example, with the Unicode 10.0 T. rex emoji, there are three lexical errors below:

module NoTRex where

tRex :: String
tRex = "🦖"

🦖 :: String
🦖 = "🦖"

produces:

[1 of 1] Compiling NoTRex           ( NoTRex.hs, NoTRex.o )

NoTRex.hs:4:9: error:
    lexical error in string/character literal at character '\129430'
  |
4 | tRex = "🦖"
  |         ^

If that's removed, the name of the function 🦖 is also shown to be a lexical error.

Also, pasting the fourth line into GHCi pastes only the characters before the first 🦖, like the 🦖 and everything afterward weren't pasted in.


System information:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.3

$ lsb_release -ds
Ubuntu 16.04.5 LTS 
Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information