Method contexts

Simon Peyton-Jones simonpj at microsoft.com
Mon Jan 29 09:33:34 EST 2001


Yes, it was a bug.  I've just fixed it.  Thanks for the report.

Simon

| BTW, there is a bug in the ghc's CVS HEAD. The following program:
| 
| class Eq k => Member c k where
|     member :: c -> k -> Bool
| class Member c a => Seq c a where
|     list :: c -> [a]
| instance Eq a => Member [a] a where
|     member = flip elem
| instance Seq [a] a where
|     list = id
| type F = Int -> Int
| test:: [F] -> F -> Bool
| test = member
| main:: IO ()
| main = print ((id :: F) == id)
| 
| does compile. When the definition of test is removed, there is a
| correst error about missing instance Eq (Int -> Int). The use of
| member:: [F] -> F -> Bool magically creates this instance!





More information about the Glasgow-haskell-bugs mailing list