We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(<$)=fmap . const 与 (<$)=fmap const 有什么区别? 1.前者是中间有个复合函数运算符 2.后者直接把const当作f函数,将f函数提升到函子盒子级别
The text was updated successfully, but these errors were encountered:
看来你已经自问自答了😄 所以你的问题是? 另外(<$)=fmap const是出自哪里的定义?
(<$)=fmap const
Sorry, something went wrong.
magic-haskell ,P136页, (<$) :: Functor f => a -> f b -> fa (<$) = fmap (.) const
($>) ::Functor f => f a -> b -> f b ($>) = flip (<$)
这都是书上的定义呀。 我想询问的是 fmap (。) const fmap const 这两个表达式有什么区别?
并不是出自书上的定义,我也没有在别的地方看到有定义这样的(<$)运算符。
(<$)
1.前者是中间有个复合函数运算符 2.后者直接把const当作f函数,将f函数提升到函子盒子级别
这两个表达式的区别你不是说得挺清楚了嘛,两个表达式的含义很不同呀:
fmap (.) const == \ x y -> fmap (const x) y -- 组合函数,先应用const,再应用fmap fmap const == \ x -> fmap const x -- 部分应用,直接应用fmap
No branches or pull requests
(<$)=fmap . const
与 (<$)=fmap const
有什么区别?
1.前者是中间有个复合函数运算符
2.后者直接把const当作f函数,将f函数提升到函子盒子级别
The text was updated successfully, but these errors were encountered: