Opened 14 years ago

Closed 11 years ago

Last modified 4 years ago

#179 closed bug (fixed)

Instance match failure on openTypeKind

Reported by: simonpj Owned by: simonpj
Priority: normal Milestone: 6.8.1
Component: Compiler (Type checker) Version: 6.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: tc175
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonmar)


    instance Show (a->b) where ...

    foo x = show (\ _ -> True)

This fails with:
    No instance for (Show (t -> Bool))
      arising from use of `show' at Foo.hs:5

Reason: the type of (\_ -> True) is  (t -> Bool) where
t has an "openTypeKind".  It's possible that the function 
will be applied to say an Int#, and the openTypeKind 
records that this is OK.

BUT, the instance decl Show (a->b) has 
a::liftedTypeKind, and that doesn't match an 
openTypeKind type variable.

This bug relates to GHC's unsatisfactory treatment of 
the variants of kind "type", for which there are at least 2 
other SourceForge bugs registered (753780 and  
753777).  It's very obscure, so I'm not going to fix it 

Change History (10)

comment:1 Changed 12 years ago by simonpj

Logged In: YES 

I'm bumping up the priority of this bug, because it also 
happens if, in GHCi, you say

   Prelude> :m +Text.Show.Functions
  Text.Show.Functions> print (\x -> x)

  (this elicits a no-such-instance error)

It's even more perplexing that this does not happen if you say
   > print id

becuase 'id' has kind-defaulted type variables in its type.  

comment:2 Changed 12 years ago by simonmar

Logged In: YES 

ghci015 now tests for this bug.

comment:3 Changed 12 years ago by simonmar

Architecture: Unknown
Description: modified (diff)
difficulty: Unknown
Operating System: Unknown
Version: None6.4.1

comment:4 Changed 11 years ago by igloo

Milestone: 6.8

Test tc175 tests this; ghci015 doesn't seem to any more.

comment:5 Changed 11 years ago by igloo

Test Case: tc175

comment:6 Changed 11 years ago by simonpj

Resolution: Nonefixed
Status: assignedclosed

Fixed at last! Cf #963


comment:7 Changed 10 years ago by igloo

Milestone: 6.8 branch6.8.1

comment:8 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:9 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:10 Changed 4 years ago by Ian Lynagh <igloo@…>

In 837aafa66533f44e0cbc83235048c5ff1beeeeb6/ghc:

tc175 / trac #179 fixed
Note: See TracTickets for help on using tickets.