【发布时间】:2016-03-11 05:52:52
【问题描述】:
我有一个类的定义
class Functor f => Pointed f where
pure :: a -> f a
现在我想为Maybe 创建实例。为什么这不起作用?
instance Pointed (Maybe s) where
pure Nothing = Nothing
pure (Just a) = a
class Functor f where
fmap :: (a->b) -> f a -> f b
错误是:
Kind mis-match
The first argument of `Pointed' should have kind `* -> *',
but `Maybe s' has kind `*'
In the instance declaration for `Pointed (Maybe s)'
Failed, modules loaded: none.
【问题讨论】:
标签: haskell