[Haskell-cafe] flip1 through flip9, useful?

Michael Orlitzky michael at orlitzky.com
Tue Jan 14 22:25:21 UTC 2014


On 01/14/2014 01:06 AM, Ivan Lazar Miljenovic wrote:
> On 14 January 2014 16:48, Christian Marie <christian at ponies.io> wrote:
>> 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.hs
> 
> Except for completeness, I don't see the point of rotate1 and flip1.
> 

It could be nice if you're attempting something insane with e.g.
template haskell and don't want n=1 to be a special case.




More information about the Haskell-Cafe mailing list