Regression around quantified constraints and superclasses
GHC 9.2 (and HEAD) reject the following, despite the fact that GHC 8.10.5 accepts:
{-# LANGUAGE QuantifiedConstraints #-}
module Bug2 where
f :: (forall a. Ord (m a), forall a. Semigroup a => Eq (m a)) => m Int
f = f
The problem is that, in the ambiguity check, GHC has [W] Eq (m a)
. But it has two ways to solve an [W] Eq (m a)
constraint: either from the quantified constraint for Eq (m a)
or from the superclass of the quantified constraint for Ord (m a)
. And so GHC, when presented with a fork in the road, crashes.
The Semigroup a =>
constraint is necessary to trigger the problem.
I don't know how GHC 8.10.5 accepted this program, and I have not yet explored further.