Skip to content

Kind polymorphism fails with recursive type definition using different kind

{-# LANGUAGE GADTs, PolyKinds #-}
module Bug where
    data R t where
        MkR :: R f -> R (f ())

results in

Bug.hs:4:26:
    Kind mis-match
    The first argument of `R' should have kind `* -> k0',
    but `f ()' has kind `k0'
    In the type `R (f ())'
    In the definition of data constructor `MkR'
    In the data type declaration for `R'
Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information