Interaction of ConstraintKinds and QuantifiedConstraints. There was already an issue about it https://gitlab.haskell.org/ghc/ghc/-/issues/16139 .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
data Rose f a = Branch a (f (Rose f a)) | |
type Eq1 f = (forall b. Eq b => Eq (f b)) | |
{- | |
ng.hs:6:33: error: | |
• Expected a type, but ‘Eq (f b)’ has kind ‘Constraint’ | |
• In the type ‘(forall b. Eq b => Eq (f b))’ | |
In the type declaration for ‘Eq1’ | |
| | |
6 | type Eq1 f = (forall b. Eq b => Eq (f b)) | |
| ^^^^^^^^ | |
Failed, no modules loaded. | |
-} | |
instance (Eq a, Eq1 f) => Eq (Rose f a) where | |
Branch x1 c1 == Branch x2 c2 = x1==x1 && c1==c2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
data Rose f a = Branch a (f (Rose f a)) | |
instance (Eq a, forall b. Eq b => Eq (f b)) => Eq (Rose f a) where | |
Branch x1 c1 == Branch x2 c2 = x1==x1 && c1==c2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE QuantifiedConstraints #-} | |
{-# LANGUAGE RankNTypes #-} | |
import Data.Kind | |
data Rose f a = Branch a (f (Rose f a)) | |
type Eq1 f = (forall b. Eq b => Eq (f b)) :: Constraint | |
instance (Eq a, Eq1 f) => Eq (Rose f a) where | |
Branch x1 c1 == Branch x2 c2 = x1==x1 && c1==c2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolver: nightly-2020-08-03 | |
packages: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment