[GHC] #6093: Kind polymorphism fails with recursive type definition using different kind
GHC
cvs-ghc at haskell.org
Sun Sep 9 07:55:32 CEST 2012
#6093: Kind polymorphism fails with recursive type definition using different kind
----------------------------------------+-----------------------------------
Reporter: Ashley Yakeley | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 7.6.1
Resolution: fixed | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: GHC rejects valid program | Difficulty: Unknown
Testcase: polykinds/T6093 | Blockedby:
Blocking: | Related:
----------------------------------------+-----------------------------------
Comment(by goldfire):
I would argue that the failure of the second of Ashley's recent examples
is not a bug, according to the manual. See
[http://www.haskell.org/ghc/docs/latest/html/users_guide/kind-
polymorphism.html#id620778 this section]. Polymorphic recursion is only
enabled for a datatype with a "complete user-supplied kind signature".
According to the manual, such a datatype ''must'' be defined with GADT
syntax and with a top-level {{{::}}}. The second example above does not
have a top-level (i.e. outside of any parentheses) {{{::}}}, so it does
not have a "complete user-supplied kind signature" and thus cannot use
polymorphic recursion.
As I understand it, Simon struggled a bit with the design around this
issue, trying to balance kind inference with polymorphic recursion. The
final result is something of a compromise, and is admittedly a little
fiddly and can be unexpected behavior. However, it is well defined in the
manual.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6093#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list