[GHC] #16024: Kind Signatures on data instances

#16024: Kind Signatures on data instances -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- There's a comment in `compiler/typecheck/TcInstDcls.hs` that reads:
The "header" is the part other than the data constructors themselves
e.g. `data instance D [a] :: * -> * = ...`
Here the "header" is the bit before the "=" sign
What's weird is that you cannot actually compile code that this example suggests is valid. Consider this: {{{ {-# language TypeFamilies #-} module BadSig where data family Bar a :: * data instance Bar Int :: * = Bool }}} It fails on GHC 8.6.2 with: {{{ bad_sig.hs:6:28: error: parse error on input ‘=’ Perhaps you need a 'let' in a 'do' block? e.g. 'let x = 5' instead of 'x = 5' | 6 | data instance Bar Int :: * = Bool | ^ }}} Oddly, GHC will accept the instance if the body is missing: {{{ {-# language TypeFamilies #-} module BadSig where data family Bar a :: * data instance Bar Int :: * }}} It is not clear to me whether or not this one should be accepted, but that is beside the point. The first example should certainly be accepted. It should also be accepted with `TYPE 'LiftedRep` instead of `*`, but it fails with the same parser error when given that kind signature as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16024 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16024: Kind Signatures on data instances -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): This has nothing to do with data instances. Datatype declarations that use `=` cannot also have a kind signature; only GADT-syntax declarations can have a kind signature. An empty datatype is considered to be in GADT syntax. So the bug here essentially just a thinko in that comment. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16024#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16024: Kind Signatures on data instances
-------------------------------------+-------------------------------------
Reporter: andrewthad | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.3
Component: Compiler | Version: 8.6.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#16024: Kind Signatures on data instances -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed Comment: Another one bites the dust. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16024#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16024: Kind Signatures on data instances -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): Thanks! This makes sense now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16024#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC