:: (c -> d) -> (a -> b -> c) -> a -> b -> d -package:intro -package:xmonad-contrib -package:composition-prelude -is:exact
Compose two functions.
f .: g is similar to
f . g
except that
g will be fed
two arguments instead of one
before handing its result to
f.
This function is defined as
(f .: g) x y = f (g x y)
Example usage:
concatMap :: (a -> [b]) -> [a] -> [b]
concatMap = concat .: map
Notice how
two arguments (the function
and the list)
will be given to
map before the result is passed to
concat. This is equivalent to:
concatMap f xs = concat (map f xs)
Equivalent to
.:
The pattern of appending asterisks is straightforward to extend to
similar functions: (compose2 = .*, compose3 = .**, etc). However,
.: has been commonly adopted amongst Haskellers, and the need
for compose3 and beyond is rare in practice.
Compose composed with compose operator.
(f ... g) x y === f (g x y)
Binary composition: pass two args to the right argument before
composing.
(f .: g) x y = f (g x y)
or,
f .: g = curry (f . uncurry g)
This is the same as the common idiom
(f .) . g but more
easily extended to multiple uses, due to the fixity declaration.
Wrap the result of a function applied to 2 arguments.