Similar quantified constraints cancel each other
[Edit: please kindly ignore, while I think this through after Simon demolished my naive understanding of constraints.]
This affects GHC 9.2.8, 9.4.5 and 9.6.2.
Here's the example: https://play.haskell.org/saved/sJujfhPD (edit: and a simpler example without any quantifiers: https://play.haskell.org/saved/h0Pz4cUB)
Without the , Tensor ranked
line it compiles and without the , CRankedY2 ranked BooleanMatchesYR
line it compiles, but keeping both quantified constraints makes both unsatisfiable. It's essential that the constraints are similar, but not identical. Actually, to repro with 9.6.2, I had to made them more dissimilar. With older GHCs it was enough to swap the order of constraints in the quantified constraint's context.
The workaround for this bug is to the remove one of the quantified constraints.