[Haskell] Empty instance declaration

Neil Mitchell ndmitchell at gmail.com
Fri Dec 28 10:52:01 EST 2007


Hi

> The trouble, of course, is that classes could have rather complicated
> "minimum instance" requirements.  Still, if someone came up with a
> decent syntax such as (but better than)

You don't need a syntax, the information is already there. You also
don't need to do complicated non-termination analysis. Taking the
slightly simpler example of:

class Eq a where
   a == b = not (a /= b)
   a /= b = not (a == b)

>From this example its clear that (==) depends on (/=) and that (/=)
depends on (==). i.e. its obvious they form a cycle.  If the default
methods form a cycle, and the user has not broken that cycle by
inserting a real implementation, that's almost certainly a bug - I'd
go as far as to say its an error rather than a warning.

Thanks

Neil


More information about the Haskell mailing list