Skip to content

Instantly share code, notes, and snippets.

@isomorphism
Created February 22, 2015 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isomorphism/daf6ea42a0e0416a29ed to your computer and use it in GitHub Desktop.
Save isomorphism/daf6ea42a0e0416a29ed to your computer and use it in GitHub Desktop.
Kind incompatibility error
{-# 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
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