Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#10570 closed bug (fixed)

Terrible error message with fundeps and PolyKinds

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

Description (last modified by danilo2)

Hello! Let's look at this small example:

class ConsByIdx2 x a m cls | x -> m where
    consByIdx2 :: x -> a -> m cls


instance ConsByIdx2 Int a Proxy cls where
    consByIdx2 _ _ = Proxy

It fails to compile with the following error:

    Illegal instance declaration for ‘ConsByIdx2 Int a Proxy cls’
      The liberal coverage condition fails in class ‘ConsByIdx2’
        for functional dependency: ‘x -> m’
      Reason: lhs type ‘Int’ does not determine rhs type ‘Proxy’
    In the instance declaration for ‘ConsByIdx2 Int a Proxy cls’

But Int determines the Proxy in a nice way.

Change History (8)

comment:1 Changed 4 years ago by danilo2

Description: modified (diff)

comment:2 Changed 4 years ago by danilo2

Oh, I just discovered it was caused by the -XPolyKinds flag. This ticket is no longer valid in this situation! :)

comment:3 Changed 4 years ago by danilo2

Resolution: invalid
Status: newclosed

comment:4 Changed 4 years ago by simonpj

Resolution: invalid
Status: closednew
Summary: Too restrictive liberate coverage conditionTerrible error message with fundeps and PolyKinds

I'm going to re-open because the error message is so terrible. It should jolly well mention kinds, suggest -fprint-explicit-kinds etc

comment:5 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In 2d06a9f19d5b3ab8c3ff0b24f508c15bedae99d2/ghc:

Improve error message for fundeps

Improve error message fundeps, especially when PolyKinds means that
the un-determined variables are (invisible) kind variables.

See Trac #10570.

comment:6 Changed 4 years ago by simonpj

Resolution: fixed
Status: newclosed

comment:7 Changed 4 years ago by thomie

Milestone: 8.0.1

comment:8 Changed 2 years ago by simonpj

Keywords: FunDeps added
Note: See TracTickets for help on using tickets.