-
-
Save isomorphism/daf6ea42a0e0416a29ed to your computer and use it in GitHub Desktop.
Kind incompatibility error
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 NoMonomorphismRestriction #-} | |
{-# LANGUAGE Rank2Types #-} | |
{-# LANGUAGE PolyKinds #-} | |
module A where | |
import Control.Lens | |
import Data.Vinyl | |
import GHC.TypeLits | |
class A f where | |
a :: f a a | |
instance A (->) where | |
a = id | |
type Foo = forall f a. A f => f a a | |
foo :: Foo | |
foo = a | |
bar :: forall f a. A f => f a a | |
bar = a |
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
module B where | |
import A | |
import Control.Lens | |
import Data.Vinyl | |
import GHC.TypeLits | |
baz x = bar x -- this is fine | |
baz' x = foo x | |
{- | |
B.hs:11:10: | |
Kind incompatibility when matching types: | |
a0 :: AnyK | |
t1 :: * | |
Expected type: t1 -> t | |
Actual type: f0 a0 a0 | |
Relevant bindings include | |
x :: t1 (bound at B.hs:11:6) | |
baz' :: t1 -> t (bound at B.hs:11:1) | |
The function ‘foo’ is applied to one argument, | |
but its type ‘f0 a0 a0’ has none | |
In the expression: foo x | |
In an equation for ‘baz'’: baz' x = foo x | |
Failed, modules loaded: A. | |
-} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment