
On 14 January 2014 16:48, Christian Marie
I have defined a bunch of functions like this:
-- | Move the fourth argument to the first place rotate4 :: (a -> b -> c -> d -> e) -> (d -> a -> b -> c -> e)
-- | Reverse four arguments flip4 :: (a -> b -> c -> d -> e) -> (d -> c -> b -> a -> e)
I decided to upload this as a library to hackage, as I personally find it useful, especially for writing FFI bindings.
It seems like I can't be the first to write a library like this though, am I missing something obvious? Is this useful or stupid? Does it exist already?
Full definition here:
https://github.com/christian-marie/flippers/blob/master/src/Control/Flippers...
Except for completeness, I don't see the point of rotate1 and flip1. I'd also be tempted to possibly shift the module to Data.Function.Flippers (as flip is re-exported by Data.Function in base, and it seems like a more valid location to me). That said, whilst I do use flip upon occasion, I think in the general case it'd be too easy to abuse these kinds of functions and could be more difficult to work any errors if you used the wrong one or had some arguments in the wrong order. -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com