Dzięki ograniczeniom ilościowym mogę dobrze wyprowadzić Eq (A f)? Jednak gdy próbuję wyliczyć Ord (A f), to się nie udaje. Nie rozumiem, jak stosować ograniczenia ilościowe, gdy klasa ograniczeń ma nadklasę. Jak uzyskać Ord (A f)i inne klasy, które mają nadklasy?
> newtype A f = A (f Int)
> deriving instance (forall a. Eq a => Eq (f a)) => Eq (A f)
> deriving instance (forall a. Ord a => Ord (f a)) => Ord (A f)
<interactive>:3:1: error:
• Could not deduce (Ord a)
arising from the superclasses of an instance declaration
from the context: forall a. Ord a => Ord (f a)
bound by the instance declaration at <interactive>:3:1-61
or from: Eq a bound by a quantified context at <interactive>:1:1
Possible fix: add (Ord a) to the context of a quantified context
• In the instance declaration for 'Ord (A f)'
PS. Przeanalizowałem również propozycje ghc 0109-ograniczenia ilościowe . Korzystanie z ghc 8.6.5
deriving instance (forall a. (Eq a, Ord a) => (Eq (f a), Ord (f a))) => Ord (A f). Czy wiesz, dlaczego jest różnica?