【发布时间】:2017-07-26 04:26:37
【问题描述】:
在 Haskell 编程中有一个问题说: 完成以下声明:
instance Functor ((->) a) where
现在 Functor Thing 的类型定义为:
instance Functor Thing where
--fmap::(a -> b) -> Thing a -> Thing b
我想知道这种减少是否有意义:
instance Functor ((->) a) where
-- fmap::(a -> b) -> ((->) a) a -> ((->) a) b
-- therefore
-- fmap::(a -> b) -> a -> a -> (a -> b)
-- therefore
-- fmap::b -> b
——更新—— 我错过了括号,应该是
instance Functor ((->) a) where
-- fmap::(a -> b) -> ((->) a) a -> ((->) a) b
-- therefore
-- fmap::(a -> b) -> (a -> a) -> (a -> b)
-- therefore
-- I should be returning a function of a -> b
【问题讨论】: