<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 14/01/14 15:48, Christian Marie
wrote:<br>
</div>
<blockquote
cite="mid:20140114054823.GA8955@cucumber.bridge.anchor.net.au"
type="cite">
<pre wrap="">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 class="moz-txt-link-freetext" href="https://github.com/christian-marie/flippers/blob/master/src/Control/Flippers.hs">https://github.com/christian-marie/flippers/blob/master/src/Control/Flippers.hs</a>
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
</blockquote>
Why not generalise to any functor?<br>
<br>
let flip f a = fmap ($a) f<br>
<br>
<pre class="moz-signature" cols="72">--
Tony Morris
<a class="moz-txt-link-freetext" href="http://tmorris.net/">http://tmorris.net/</a>
</pre>
</body>
</html>