On Mon, May 7, 2018 at 11:45 PM, Clinton Mead <clintonmead@gmail.com> wrote:
instance {-# OVERLAPPABLE #-} Num x => C x where ...
instance {-# OVERLAPPING #-} C Int where ...

is completely legal, and the instance used depends on context.

This is an issue with overlapping instances, but already GHC allows it. I don't think what I'm proposing is any worse to what's already legal.

Int can be verified as more specific than "matches any type". Two instance heads differing *only* in context cannot.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net