[GHC] #10654: Better error message regarding type synonyms and PolyKinds

GHC ghc-devs at haskell.org
Fri Jul 17 20:10:10 UTC 2015


#10654: Better error message regarding type synonyms and PolyKinds
-------------------------------------+-------------------------------------
              Reporter:  abbradar    |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  low         |           Version:  7.10.1
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Other
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Followup of https://mail.haskell.org/pipermail/haskell-
 cafe/2015-July/120505.html

 {{{
 ghci> :set -XPolyKinds
 ghci> type Test a = a
 ghci> type Huh = Test

 <interactive>:6:1:
     Type synonym ‘Test’ should have 2 arguments, but has been given 1
     In the type declaration for ‘Huh’
 }}}

 (Notice the number of arguments reported)

 Jonas Scholl at haskell-cafe suggested that the additional invisible
 argument is a kind argument, which indeed looks to be the case, as he
 demonstrated:

 {{{
 Prelude> :set -XPolyKinds -XDataKinds -XKindSignatures
 Prelude> type Test a = a
 Prelude> type Huh a = Test (a :: Bool)
 Prelude> type Bar = Huh

 <interactive>:5:1:
     Type synonym ‘Huh’ should have 1 argument, but has been given none
     In the type declaration for ‘Bar’
 }}}

 A better error message may be desirable here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10654>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list