Two-argument function composition

Haskell

Public Domain

Like (.), but for function pairings that take an extra argument on one side or the other

Download (right click, save as, rename as appropriate)

Embed

1
2
3
4
5
6
7
infixr 9 .$., $..

(.$.) :: (a -> b -> c) -> (d -> b) -> a -> d -> c
(.$.) f g x = f x . g  -- equivalent to ``(.$.) f g x y = f x (g y)''

($..) :: (a -> b) -> (c -> d -> a) -> c -> d -> b
($..) f g x = f . g x  -- equivalent to ``($..) f g x y = f (g x y)''