After `{-# OVERLAPPING #-}` comes `{-# INCOHERENT #-}`, but why?

Hi, thank you for answering!

Your example looks neat only because there’s a single class method. What happens if there are two or more class methods? What happens if there are zero, where do you specify the instance context then? I have a feeling you’ll need two levels of nesting instead of just one as you envisioned.

I do agree that the syntax needs a lot of fleshing out - I think it would also be quite unintuitive to write the fat arrow before the definition of a function, but I also do not currently have a good idea of making it look intuitive and still make it work with everything you can possibly put into an instance declaration. I will have to think about it some more, thank you for pointing me at this problem though.

You’ll need to clarify the interaction between the instance family declarations and the regular instance declarations, as in what happens

I think that’s not an issue, tbh, because from the “classical” instance declaration side of things the “instance families” can be completely opaque - if you decide between an instance and an “instance family” you would just only consider the instance head as you normally would.

if there are both for a particular class. I’m guessing you’d want at least to disallow overlap between them, because you can always resolve it inside the instance family declaration.

Same thing as before - I think the normal interactions can just be kept up as before “entering” the “instance family” you only have to consider the instance head as you normally would.
Of course it would be weird to have both overlapping instances and instance families because you can simply simulate the former with the latter. Maybe there should be a warning to discourage the use of both? However, I think there might be reasons to have both on - if you want to make sure that no matter the order you have the instance resolution resolve it via how specific the instance head is, you always want overlapping instances. You might also semantically separate instances that are just overlapping and instance families that care about order and the context.