我在阅读各种 Haskell 教程时编写的第一个程序给了我一个“Kind mis-match”错误
import qualified Data.Vector as V
class SupervisedLearner l where
learn :: l (Input n) -> Output n
data Input n = Supervised (V.Vector n ,V.Vector n) | Unsupervised (V.Vector n)
data Output n = Regression n | KClass (V.Vector n) | Bernoulli (n, n)
newtype Perceptron = Perceptron (V.Vector Float)
instance SupervisedLearner Perceptron where
learn = undefined
让我感到困惑的是,当我尝试遵循错误的类型签名时,
Kind mis-match
The first argument of `SupervisedLearner' should have kind `*
-> *',
but `Perceptron' has kind `*'
In the instance declaration for `SupervisedLearner Perceptron'
我似乎无法理解我应该从哪里开始纠正它。所以我的问题有两个,错误在哪里,一般意义上,我是否正确使用了 Haskell 类型类系统?