> > - 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
On Wed, Apr 18, 2007 at 01:47:04AM +0100, Neil Mitchell wrote:
> >- If we permit undecidable instances, one may assign numerals to
> >types. This gives us total order and hence comparison on types.
> >In this approach, we only need N instances to cover N types. This is
> >still better than Typeable
Hi
I guess it depends on how many extensions one may wish to enable. At
the very least we need multi-parameter type classes with functional
dependencies (because that's what TypeEq is in any case).
- If we permit no other extension, we need N^2 instances to compare N
classes for equality (basic
> Thanks for pointing that out. As far as I can see, this requires a new
> instance declaration for every type?
I guess it depends on how many extensions one may wish to enable. At
the very least we need multi-parameter type classes with functional
dependencies (because that's what TypeEq is in a
Hi Oleg,
> I'm looking for a type class which checks whether two types are the
> same or not.
For the full discussion of various solutions, please see Section 9 and
Appendix D of the HList paper:
http://homepages.cwi.nl/~ralf/HList/paper.pdf
Thanks for pointing that out. As far as I c
Neil Mitchell wrote:
> I'm looking for a type class which checks whether two types are the
> same or not.
This problem is more complex than appears. It has been solved,
however. IncoherentInstances are not required, as IncoherentInstances
are generally unsafe.
For the full discussion of various