Invalid constructor names are accepted in data declarations
Earlier today, someone was asking on #haskell why the constructor name (^) wouldn't work in GADT definitions. My response was that (^) isn't a constructor name, but much to my surprise, GHC accepts such names in a regular data declaration:
data Foo = F | (^^^^) Int Int
This creates a Foo type and value constructor F, but no value constructor (^^^^). However, in 7.6.3, if DataKinds are enabled, both constructors appear at the type level.
In HEAD, the same definition is accepted, with only F existing at the value level, as before. But at the type level, both F and (^^^^) just generate errors that Foo is not a promotable type. At that point, I think there's no question that the declaration should just be ruled out.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |