Anomalous Class Fundep Inference

Simon Peyton-Jones simonpj@microsoft.com
Mon, 7 May 2001 03:04:57 -0700


There's a design space about how vigorous one is about
checking for "unsatisfiable" instances when doing overlap
things.  It's quite a complicated design space that I don't
fully  understand, which is why GHC at least implements a
conservative rule.  For example, does one complain about
overlap when the instance declarations are defined, or
when they are used?  Does one assume that new instances
can be added "later"?  and there is more I think. =20

Simon

| -----Original Message-----
| From: Ashley Yakeley [mailto:ashley@semantic.org]=20
| Sent: 05 May 2001 07:53
| To: Haskell List
| Subject: RE: Anomalous Class Fundep Inference
|=20
|=20
| At 2001-05-03 01:42, Simon Peyton-Jones wrote:
|=20
| >Quite right too!
|=20
| OK, I understand it a bit better now. This code does not compile:
| --
| class X a
| instance X Bool
| instance (Num a) =3D> X a
| --
| Can someone explain why the two instances overlap, given that=20
| Bool is not=20
| an instance of Num?
|=20
| Would it be possible for Haskell to figure out this sort of=20
| thing and not=20
| complain about it, or would that lead to nasty problems?
|=20
| --=20
| Ashley Yakeley, Seattle WA
|=20
|=20
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
|=20