Skip to content

FunDep error message regression

This code (provided by Cale Gibbard)

{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}

class C a b | a -> b where
  foo :: a -> b

instance C Integer Integer where
  foo = id

f :: Integer -> String 
f = foo

produced this error message in GHC 7.6:

fundep.hs:10:5:
    Couldn't match type `Integer' with `String'
    When using functional dependencies to combine
      C Integer Integer,
        arising from the dependency `a -> b'
        in the instance declaration at fundep.hs:6:10
      C Integer String, arising from a use of `foo' at fundep.hs:10:5-7
    In the expression: foo
    In an equation for `f': f = foo

but this one with GHC HEAD

FunDepError.hs:11:5:
    No instance for (C Integer String) arising from a use of ‛foo’
    In the expression: foo
    In an equation for ‛f’: f = foo

which seems to be a regression.

It may be that either message is fine (it seems to be in this case), In that case, this bug is about the test suite not having a test case for where we do want to see the When using functional dependencies to combine message.

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information