Skip to content

Data constructors can be defined with leading ticks

Surprisingly, this code compiles on GHC 8.8.2 or later:

module Bug where

data T = 'MkT

I'm pretty sure that 'MkT shouldn't parse successfully there. Indeed, compiling this with GHC 8.6.5 results in a parse error:

$ /opt/ghc/8.6.5/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:3:10: error: Not a data constructor: ‘MkT’
  |
3 | data T = 'MkT
  |          ^^^^

The commit that caused this to compile was bd789853 (Parse the (!) type operator and allow type operators in existential context). cc'ing @int-index

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information