overlapping instances and constraints

John Meacham john at repetae.net
Mon Feb 27 20:23:24 EST 2006


On Mon, Feb 27, 2006 at 05:09:30PM +0300, Bulat Ziganshin wrote:
> i had plans to propose the same and even more:
> 
> instance C2 a b | a/=b

I was thinking it would be all kinds of useful if we had two predefined
classes

class Eq a b
class NEq a b

where Eq has instances exactly when its two types are equal and NEq has
instances exactly when its two types are not equal.

Eq should be straightforward to implement, declaring any type
automatically creates its instances. (sort of an auto-deriving). NEq
might be more problematic as that would involve a quadratic number of
instances so its implementation might need to be more special. but
perhaps we can do with just 'Eq'.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-prime mailing list