Skip to content

Variable name with special characters

Declaring a variable in GHCi with $ . is allowed, but they are not referable. I suppose that the parser should impose more restrictions at this.

*Main> let a$1 = 10
*Main> a$1
<interactive>:20:1: Not in scope: a

Prelude> let a.1 = 10
Prelude> a.1

<interactive>:9:1: Not in scope: a

Prelude> let a%1 = 1
Prelude> a%1
1
Prelude> let a^1 = 1
Prelude> a^1
1
Prelude> a^1 + 1
2
Trac metadata
Trac field Value
Version 7.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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