Haskell 将 Hom Functor/Monad 称为什么?
我想在我的代码中使用它,并且不想重复它,但由于它只涉及大量通用单词,如“函数”或“组合”,我无法通过搜索找到它。
完全具体地说,我正在寻找
instance Functor (x->) where
fmap f p = f . p
I'd like to use it in my code and would rather not duplicate it, but since it involves only massively generic words like "function" or "composition" I can't find it by searching.
To be completely specific, I'm looking for
instance Functor (x->) where
fmap f p = f . p
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是基本的读取器(或环境)单子,通常称为
((->) e)
。 (这是作为部分应用函数而不是部分编写的(e ->)
;后一种语法解析起来有问题。)您可以通过导入Control.Monad 来获取它。 Reader
或Control.Monad.Instances
。This is the basic reader (or environment) monad, usually referred to as
((->) e)
. (This is(e ->)
written as a partially applied function instead of as a section; the latter syntax is problematic to parse.) You can get it by importingControl.Monad.Reader
orControl.Monad.Instances
.