Questions tagged «quantified-constraints»

1
导出具有量化约束的Ord(总a。Ord a => Ord(fa))
有了量化的约束,我可以得出Eq (A f)结论吗?但是,当我尝试导出Ord(A f)时会失败。当约束类具有超类时,我不理解如何使用量化约束。我如何派生Ord (A f)以及其他具有超类的类? > 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 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.