Skip to content

Better error message regarding type synonyms and PolyKinds

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.

Trac metadata
Trac field Value
Version 7.10.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information