我有一个通过 ghc 7.4.1 中的 DataKinds 推广的数据类型和一个我想用来执行类型特定操作的给定类型类。
data Type = TInt32 | TInt64 | TInt16
class TypeTraits a where
...
然后我尝试创建提升类型的类型类实例,如下所示:
instance TypeTraits TInt32 where
...
我收到以下类型的错误:
Kind mis-match
The first argument of `TypeTraits' should have kind `*',
but `TInt32' has kind `Type'
In the instance declaration for `TypeTraits TInt32'
试图通过指定“a”的类型来解决这个问题:
class TypeTraits (a :: Type) where
...
Kind mis-match
Expected kind `ArgKind', but `a' has kind `Type'
In the type `a -> String'
In the class declaration for `TypeTraits'