Opened 23 months ago

Closed 23 months ago

Last modified 23 months ago

#10654 closed feature request (duplicate)

Better error message regarding type synonyms and PolyKinds

Reported by: abbradar Owned by:
Priority: low Milestone:
Component: Compiler Version: 7.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: #10516 Differential Rev(s):
Wiki Page:

Description

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.

Change History (2)

comment:1 Changed 23 months ago by thomie

Resolution: duplicate
Status: newclosed

Thanks for the report. A fix is underway in #10516.

λ:1> :set -XPolyKinds
λ:2> type Test a = a
λ:3> type Huh = Test

<interactive>:3:1: error:
    The type synonym ‘Test’ should have 1 argument, but has been given none
    In the type synonym declaration for ‘Huh’

comment:2 Changed 23 months ago by abbradar

Thanks and sorry for the duplicate, I will search better next time.

Note: See TracTickets for help on using tickets.