<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 13, 2014 at 10:57 PM, Tony Morris <span dir="ltr"><<a href="mailto:tonymorris@gmail.com" target="_blank">tonymorris@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div><div>
<div>On 14/01/14 15:48, Christian Marie
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div>
<pre>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:
<a href="https://github.com/christian-marie/flippers/blob/master/src/Control/Flippers.hs" target="_blank">https://github.com/christian-marie/flippers/blob/master/src/Control/Flippers.hs</a>
</pre>
<br>
<fieldset></fieldset>
<br>
</div></div><div><pre>_______________________________________________
Haskell-Cafe mailing list
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
</div></blockquote>
Why not generalise to any functor?<br>
<br>
let flip f a = fmap ($a) f</div></blockquote><div><br></div><div>I don't see that operator as "flip-like", personally. It might behave as flip in the case of the function functor , but that intuition does not carry over to things like</div>
<div><br></div><div>fmap ($a) [f, g, h] = [f a, g a, h a]</div><div><br></div><div>I'd call it "funder", personally.</div></div></div></div>