
I don't know what is the best name for it, but I have found myself defining
this function lot of times.
On Wed, Oct 10, 2012 at 7:15 AM, Merijn Verstraaten
I keep finding myself needing to apply functions to both elements in a tuple and now that I've started playing around with AFRP libraries I find myself applying arrows to both sides of tuples there too. As a result I would like to propose the following addition to Control.Arrow:
both :: Arrow a => a b c -> a (b, b) (c, c) both = join (***) -- or if importing join from Control.Monad is undesirable both f = f *** f
Why not just write "f *** f" I hear you ask? Because when f is not a trivial expression then you need to either bind it to a new name and use "newName *** newName" (which I personally dislike, because I'm terrible at coming up with names) or write "join (***) f" which I don't find a particularly appealing notation either.
Kind regards, Merijn Verstraaten
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries