[GHC] #8391: FunDeps coverage condition check failure with PolyKinds
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------+---------------------------------------------- Reporter: sbarclay | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects valid program Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: #8356 | ----------------------------+---------------------------------------------- The following code: {{{ #!haskell {-# LANGUAGE FunctionalDependencies, FlexibleInstances, UndecidableInstances, TypeFamilies, PolyKinds #-} module FunDepsIssue where type Foo a = a class Foo a ~ b => Bar a b | a -> b instance Foo a ~ b => Bar a b }}} results in: {{{ Illegal instance declaration for ‛Bar k a b’ Multiple uses of this instance may be inconsistent with the functional dependencies of the class. In the instance declaration for ‛Bar a b’ }}} This appears to be a regression from 7.6.3, where it compiles OK. The same error occurs when the type synonym is replaced with a type family (which is the case I was originally interested in) or a type constructor like `Data.Proxy`, as long as it's poly-kinded it seems. So the following cases also fail to compile: {{{ #!haskell type family Foo (a :: k) :: * type family Foo (a :: *) :: k type family Foo (a :: k) :: k type family Foo (a :: k) :: k' }}} Looking through the source code, I think that the issue is that the coverage condition check doesn't close over kind variables, when it compares the vars on each side of the functional dependency. But `Foo a` has a hidden kind variable, so the l.h. varset `{a}` is insufficient to fix `b` using `Foo a ~ b`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------------------------+---------------------------- Reporter: sbarclay | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #8356 ----------------------------------------------+---------------------------- Comment (by simonpj): Good catch. Patch coming. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------------------------+---------------------------- Reporter: sbarclay | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #8356 ----------------------------------------------+---------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:9d908c523bf61936ef372b70d5f8548fb36da26e/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="9d908c523bf61936ef372b70d5f8548fb36da26e" Close over kinds when checking fundep coverage (Trac #8391) See Note [Closing over kinds in coverage] in FunDeps }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------------------------+---------------------------- Reporter: sbarclay | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #8356 ----------------------------------------------+---------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:d16da2f376d5994add04ba8e5b2fac4bc91f8e68/testsuite]: {{{ #!CommitTicketReference repository="testsuite" revision="d16da2f376d5994add04ba8e5b2fac4bc91f8e68" Test Trac #8391 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------------------------+---------------------------- Reporter: sbarclay | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: polykinds/T8391 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #8356 ----------------------------------------------+---------------------------- Changes (by simonpj): * status: new => closed * testcase: => polykinds/T8391 * resolution: => fixed Comment: Fixed thank you. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8391: FunDeps coverage condition check failure with PolyKinds ----------------------------------------------+---------------------------- Reporter: sbarclay | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #8356 | polykinds/T8391 | Blocking: ----------------------------------------------+---------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"49d9b009a2affb6015b8f6e2f15e4660a53c0d9a/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="49d9b009a2affb6015b8f6e2f15e4660a53c0d9a" Fix fundep coverage-condition check for poly-kinds See Note [Closing over kinds in coverage] in FunDeps. I'd already fixed this bug once, for Trac #8391, but I put the call to closeOverKinds in the wrong place, so Trac #10109 failed. (It checks the /liberal/ coverage condition, which The fix was easy: move the call to the right place! }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8391#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC