Skip to content

ghci misinterprets "early" unicode characters

It seems as if ghci misinterprets unicode characters if they occur too early in a source file.

$ cat test.hs
--data A = A -- example will not work if this line is commented
笑 :: [a] -> Int
笑 = length
$ ghci test.hs
GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( test.hs, interpreted )

test.hs:2:0:
    Illegal signature in pattern: [a] -> Int 笑
        Use -XScopedTypeVariables to permit it
Failed, modules loaded: none.
Prelude>

Uncommenting the first line makes the problem go away.

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
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