[GHC] #10516: PolyKinds results in incorrect reporting of type synonym parameter count

GHC ghc-devs at haskell.org
Sat Jun 13 15:45:18 UTC 2015


#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


More information about the ghc-tickets mailing list