Skip to content

Boot file instances should imply superclasses

Currently, if I write the following program:

-- A.hs-boot
module A where
data T
instance Ord T

-- B.hs
module B where
import {-# SOURCE #-} A
f :: T -> T -> Bool
f x y = x == y 

I get:

B.hs:4:11:
    No instance for (Eq T) arising from a use of `=='
    Possible fix: add an instance declaration for (Eq T)
    In the expression: x == y
    In an equation for `f': f x y = x == y

This is a bit confusing, because Ord instances are supposed to imply Eq instances.

GHC should either:

  1. Reject A.hs-boot (claiming that it could not find evidence that T had an Eq instance), or
  2. Accept B.hs, since the instance requirement for Ord should imply Eq.
Trac metadata
Trac field Value
Version 7.11
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information