Simple addition to Control.Arrow

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Tue Jan 8 03:21:01 CET 2013


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
<merijn at inconsistent.nl>wrote:

> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130107/e899c103/attachment.htm>


More information about the Libraries mailing list