I've only skimmed the thread, so sorry if this is a red herring, but could this be helpful? https://github.com/rampion/constraint-unions/blob/master/README.md

On Tue, May 8, 2018 at 12:49 PM, Li-yao Xia <lysxia@gmail.com> wrote:
On 05/07/2018 11:45 PM, Clinton Mead wrote:
Hi Li-yao

I understand this issue, but I think what your describing doesn't relate to what I'm talking about uniquely.

For example:

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.

No instance for the C type class above will be picked until x is equal to some applied type constructor; it will be more challenging to break coherence with that than using what you're proposing.

It seems difficult to make a clear point because the whole topic of coherence with Haskell type classes is already a minefield.


Li-yao
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.