Haskell function composition operator of type (c→d) → (a→b→c) → (a→b→d)
问题 Ordinary function composition is of the type (.) :: (b -> c) -> (a -> b) -> a -> c I figure this should generalize to types like: (.) :: (c -> d) -> (a -> b -> c) -> a -> b -> d A concrete example: calculating difference-squared. We could write diffsq a b = (a - b) ^ 2 , but it feels like I should be able to compose the (-) and (^2) to write something like diffsq = (^2) . (-) . I can\'t, of course. One thing I can do is use a tuple instead of two arguments to (-) , by transforming it with