ambiguity problem

Martin Sulzmann sulzmann@comp.nus.edu.sg
Tue, 22 Apr 2003 16:38:18 +0800 (GMT-8)


Hi,

I'm using -- Hugs Version February 2001.

hugs -98 reports ambiguity for the following program

class Bar a b | a -> b where
  bar :: a -> b

class Foo a b  where
  foo :: Bar b c => a -> b


Ambiguous type signature in class declaration
*** ambiguous type : (Foo a b, Bar b c) => a -> b
*** assigned to    : foo

This strange cause the functional dependency should uniquely
determine c!

Suprisingly,

class Bar a b | a -> b where
  bar :: a -> b

class Foo a b 

-- ok
f :: (Foo a b, Bar b c) => a->b
f = undefined

is accepted.

This seems like a bug.

Martin