Skip to content

class C a b | a -> b; (C a b, Eq b) => a -- not legal

The following fragment is not accepted:

class C a b | a -> b where f :: a -> b
g :: (C a b, Eq b) => a -> Bool
g x = f x == f x

    Ambiguous type variable(s) `b' in the constraint `Eq b'
    arising from use of `==' at Test.hs:4
    In the right-hand side of an equation for `g': (f x) == (f x)

Hugs accepts it.
Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
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