[Haskell-cafe] Re: Type classes and type equality

oleg at pobox.com oleg at pobox.com
Thu Apr 19 01:57:34 EDT 2007

> > - If we permit overlapping instances extension, then a few lines of code
> > decide equality for all existing and future types:
> >
> >         class  TypeEq x y b | x y -> b
> >         instance TypeEq x x HTrue
> >         instance TypeCast HFalse b => TypeEq x y b
> This is exactly what I was after, but it doesn't seem to work in Hugs
> - even with overlapping instances and unsafe overlapping instances
> turned on.

Hugs is indeed quite problematic; back in 2004 we essentially gave up
on Hugs for anything moderately advanced, especially after Ralf found
an example which typechecks only if constraints are specified in a
particular order. If we permute the constraints (I think, it was in
the instance declaration), Hugs complaints. Clearly the order of
constraints should not matter. It has been my experience that the code
requiring undecidable instances on GHC might not work on Hugs, failing
with sometimes bizarre error messages.

More information about the Haskell-Cafe mailing list