The flip function in Haskell is used to switch the positions of the first two arguments of a function:
flip :: (a -> b -> c) -> b -> a -> c
flip f y x = f x y
Similarly we can write a function to rotate three arguments:
rot :: (a -> b -> c -> d) -> b -> c -> a -> d
rot f y z x = f x y z
Can this concept be extended to functions which curry arbitrary number of arguments?
Given a function of type a -> ... -> z is it possible to write a function of the following type?
(a -> ... -> z) -> ... -> a -> z
I know that the -> operator is right associative. Hence ... -> z can't be split. Nevertheless, I would like to know for sure.