具有反向语法的功能组成
如果我想先应用f
首先和g
第二,我必须写:
g . f
是否有另一种标准语法可以让我以相反的顺序编写功能?
f <whatever> g
我知道我只能发明自己的语法:
compose f g x = g (f x)
然后这样使用它:
f `compose` g
但是我宁愿使用标准的图书馆设施。
If I want to apply f
first and g
second, I have to write:
g . f
Is there another standard syntax that would allow me to write the functions in the reverse order?
f <whatever> g
I know I can just invent my own syntax:
compose f g x = g (f x)
and then use it like this:
f `compose` g
But I would rather use a standard library facility.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
f&gt;&gt;&gt; g
来自 control.arrow 。f >>> g
from Control.Arrow.此外,
&gt>&gt;&gt;&gt;&gt;
,某些库提供了他们自己的此功能的版本,例如:
compose
或。 .html#V:组成“ rel =” nofollow noreferrer“> flow 。
- 。
来自 coptosing-prelude 。您可以使用 hoogle 找到具有特定签名的函数示例。对于确切的问题,您可以使用 hoogle.haskell.org/?hoogle =(a - &gt; b) - &gt; (b - &gt; c) - &gt; (a - &gt; c)。
In addtition to
>>>
, some libraries provide their own version of this function, for example:compose
or.>
from Flow.-.
from composition-prelude.You may use Hoogle to find examples of functions with a specific signature. For your exact question you can use hoogle.haskell.org/?hoogle=(a -> b) -> (b -> c) -> (a -> c).