[GHC] #10516: PolyKinds results in incorrect reporting of type synonym parameter count
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: | Owner: benjamin.hodgson | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.3 Component: Compiler | Operating System: MacOS X Keywords: | Type of failure: None/Unknown Architecture: x86_64 | Blocked By: (amd64) | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- The following program is invalid because the declaration of `f` doesn't fully apply `App` to all of its arguments. {{{#!hs {-# LANGUAGE PolyKinds #-} type App f a = f a newtype X f a = X (f a) f :: f a -> X (App f) a f = X }}} However, with the `PolyKinds` extension, the error reporting is quite weird: {{{ Type synonym ‘App’ should have 4 arguments, but has been given 3 In the type signature for ‘f’: f :: f a -> X (App f) a }}} `App` has ''two'' arguments, and I gave it ''one''! I'm guessing that `PolyKinds` makes GHC supply some implicit parameters during expansion of type synonyms, and that's what gets reported in the error message. The behaviour is correct without `PolyKinds`. I've tested this on GHC 7.8.3 (the Haskell Platform version). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: None/Unknown | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by benjamin.hodgson: Old description:
The following program is invalid because the declaration of `f` doesn't fully apply `App` to all of its arguments.
{{{#!hs {-# LANGUAGE PolyKinds #-}
type App f a = f a
newtype X f a = X (f a)
f :: f a -> X (App f) a f = X }}}
However, with the `PolyKinds` extension, the error reporting is quite weird:
{{{ Type synonym ‘App’ should have 4 arguments, but has been given 3 In the type signature for ‘f’: f :: f a -> X (App f) a }}}
`App` has ''two'' arguments, and I gave it ''one''! I'm guessing that `PolyKinds` makes GHC supply some implicit parameters during expansion of type synonyms, and that's what gets reported in the error message. The behaviour is correct without `PolyKinds`.
I've tested this on GHC 7.8.3 (the Haskell Platform version).
New description: The following program is invalid because the declaration of `f` doesn't fully apply `App` to all of its arguments. {{{#!hs {-# LANGUAGE PolyKinds #-} type App f a = f a newtype X f a = X (f a) f :: f a -> X (App f) a f = X }}} However, with the `PolyKinds` extension, the error reporting is quite weird: {{{ Type synonym ‘App’ should have 4 arguments, but has been given 3 In the type signature for ‘f’: f :: f a -> X (App f) a }}} `App` has ''two'' arguments, and I gave it ''one''! I'm guessing that `PolyKinds` makes GHC supply some implicit parameters during expansion of type synonyms, and that's what gets reported in the error message. The behaviour is correct without `PolyKinds`. I've tested this on GHC 7.8.3 (the Haskell Platform version) on my 64-bit OSX Yosemite system. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: None/Unknown | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Confirmed reproducible in HEAD and 7.10.1. Thanks for reporting! -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: None/Unknown | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * version: 7.8.3 => 7.10.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: None/Unknown | (amd64) Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"5879d5aab929e9959d48e03dad456b824160b3bf/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="5879d5aab929e9959d48e03dad456b824160b3bf" Report arity errors correctly despite kinds Trac #10516 pointed out that when reporting arity errors (like "T needs 2 arguments but has been given 1"), we should not count kind arguments, since they are implicit. If we include kind args in the count, we get very confusing error messages indeed. I did a little bit of refactoring which make some error messages wobble around. But the payload of this fix is in TcValidity.tyConArityErr }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: merge Priority: high | Milestone: 7.10.3 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: None/Unknown | (amd64) Blocked By: | Test Case: Related Tickets: | polykinds/T10516 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * priority: normal => high * status: new => merge * testcase: => polykinds/T10516 * milestone: => 7.10.3 Comment: I believe I have fixed this. Could merge to the branch if convenient. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10516: PolyKinds results in incorrect reporting of type synonym parameter count -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.10.3 Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 | (amd64) Type of failure: None/Unknown | Test Case: | polykinds/T10516 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: It sadly doesn't look like this will be terribly convenient. Punting. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10516#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC