Reputation: 263088
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.
Upvotes: 57
Views: 7724
Reputation: 363
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).
Upvotes: 2