Here's a small program defining a collection class:
------------------
class Sat a where 
  dict :: a

data EqD a = EqD {eq :: a->a->Bool}

instance Sat (EqD a) => Eq a where
  (==) = eq dict

class Collection c cxt | c -> cxt where
  empty :: Sat (cxt a) => c a
  single :: Sat (cxt a) => a -> c a
  union :: Sat (cxt a) => c a -> c a -> c a
  member :: Sat (cxt a) => a -> c a -> Bool

instance Collection [] EqD where
  empty = []
  single x = [x]
  union = (++)
  member = elem
------------------
Loading this program with overlapping instances turned on produces the error message:

Type checking
ERROR "C:\windows\Skrivbord\HugsBug.hs":24 - Cannot justify constraints in instance 
member binding
*** Expression    : member
*** Type          : (Collection [] EqD, Sat (EqD a)) => a -> [a] -> Bool
*** Given context : (Collection [] EqD, Sat (EqD a))
*** Constraints   : Eq a

Very strange, given the instance declaration

    instance Sat (EqD a) => Eq a

The behaviour is the same in the February and December 2001 versions.

John Hughes


_______________________________________________
Hugs-Bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/hugs-bugs

Reply via email to