by hackyhacky · 1y ago · 0 comments
flip :: (a -> b -> c) -> b -> a -> c
flip f x y = f y xCan you write a Haskell version that works for functions with any number of arguments?
The C++ std::flip from the article, however, reverses the order of all parameters. Reproducing that in Haskell would require fancy type-level programming or compile-time metaprogramming, both of which would defeat the simplicity of my initial version.