[GHC] #10760: Conflicting typefamily instances not reported with polykinds

#10760: Conflicting typefamily instances not reported with polykinds -------------------------------------+------------------------------------- Reporter: steely | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC accepts Unknown/Multiple | invalid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- GHC fails to report conflicting instances for a open polykinded type family when the two resulting types have different kinds. I would expect conflicts to be detected regardless of the concrete kind of the result. Minimal Example: {{{#!hs type family Bar a :: k type instance Bar Int = Int --type instance Bar Int = Bool -- Conflict detected type instance Bar Int = [] -- Conflict NOT detected }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10760 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10760: Conflicting typefamily instances not reported with polykinds -------------------------------------+------------------------------------- Reporter: steely | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => invalid Comment: This is correct behavior. All kind variables in a type family are always inputs. This is admittedly counter-intuitive when the kind variable classifies the result. If we write kinds explicitly, your example becomes this: {{{ type family Bar k (a :: *) :: k type instance Bar * Int = Int type instance Bar (* -> *) Int = [] }}} If you have a concrete suggestion of how to improve the manual in this regard, we'd love to have it. Thanks for reporting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10760#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10760: Conflicting typefamily instances not reported with polykinds -------------------------------------+------------------------------------- Reporter: steely | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by steely): I understand. This is indeed very subtle and ought to be documented. I am not sure whether this explanation should go in the section about type families alone, since this issue is related to their interaction with PolyKinds, but anyway it would be more precise to include something like: In the paragraph about "Type Family Declarations". The result kind annotation is optional and, as usual, defaults to * if omitted. Polykinded type families can be declared using a parameter in the kind annotation: {{{ type family F a :: k }}} Note that in this case the kind parameter k is an actual implicit parameter of the type family and as such is relevant when checking the apartness of type family equations. In the paragraph about "Compatibility and apartness of type family equations'": 1. all corresponding types and '''implicit kinds''' in the patterns are apart. The example of this ticket could also be included to show this. I am not sure whether in GHC 7.10 kind variables have to be explicitly given in type families, making it more intuitive. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10760#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10760: Conflicting typefamily instances not reported with polykinds
-------------------------------------+-------------------------------------
Reporter: steely | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Resolution: invalid | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC accepts | Unknown/Multiple
invalid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#10760: Conflicting typefamily instances not reported with polykinds -------------------------------------+------------------------------------- Reporter: steely | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Thanks for the suggestion! I've put that in. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10760#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC