Opened 7 years ago

Closed 7 years ago

#7410 closed bug (fixed)

Type error says that tuple components have kind (* -> *)

Reported by: benl Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case: typecheck/should_fail/T7410
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Prelude Data.Map> :kind (,)
(,) :: * -> * -> *

The following type error says that the second argument to (,) should have kind * -> *, which isn't true.

Prelude> :m +Data.Map
Prelude Data.Map> :kind (Map Int, Int)
<interactive>:1:11:
    The second argument of a tuple should have kind `* -> *',
      but `Int' has kind `*'
    In a type in a GHCi command: (Map Int, Int)

Now it can't make up its mind:

Prelude Data.Map> :kind (Int, Map Int)
<interactive>:1:7:
    Expecting one more argument to `Map Int'
    The second argument of a tuple should have kind `*',
      but `Map Int' has kind `* -> *'
    In a type in a GHCi command: (Int, Map Int)

Change History (3)

comment:1 Changed 7 years ago by simonpj@…

commit 1135c8439e606b2b0cebd138afbb4c5716f3abcc

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Nov 26 12:07:37 2012 +0000

    Improve kind inference for tuple types
    
    Trac #7410 pointed out a terrible error message, which is
    much improved by this patch.

 compiler/main/ErrUtils.lhs      |    5 ++++-
 compiler/typecheck/TcHsType.lhs |   30 +++++++++++++++++++++---------
 2 files changed, 25 insertions(+), 10 deletions(-)

comment:2 Changed 7 years ago by simonpj

difficulty: Unknown
Status: newmerge
Test Case: typecheck/should_fail/T7410

Thanks. Now improved. Pls merge if it's smooth to do so.

comment:3 Changed 7 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.