On Tue, Nov 20, 2012 at 2:14 PM, John Wiegley <span dir="ltr"><<a href="mailto:johnw@fpcomplete.com" target="_blank">johnw@fpcomplete.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Moving discussion from <a href="http://hackage.haskell.org/trac/ghc/ticket/7435" target="_blank">http://hackage.haskell.org/trac/ghc/ticket/7435</a>:<br>
<br>
I propose adding the following three functions to Data.Tuple and<br>
Data.Function, respectively:<br>
<br>
swap :: (a,b) -> (b,a)<br>
swap = snd &&& fst<br>
<br></blockquote><div><br></div>Data.Tuple already contains swap.<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Fairly obvious, but strangely missing.<br>
<br>
compose :: [(a -> a)] -> a -> a<br>
compose = foldr (.) id<br>
<br>
composeM :: [(a -> m a)] -> a -> m a<br>
composeM = foldr (<=<) return<br></blockquote><div> </div><div>I would actually consider these to fall beneath the "Fairbairn threshold". </div><div><br></div><div>The composition of them is obvious, and the suggested names already exist commonly in a lot of third party code for all sorts of purposes.</div>
<div><br></div><div>The pain of adoption plus the annoyance of trying to find them exceeds, to me, the utility of adding them.</div><div><br></div><div>-Edward</div><div> </div></div>