Simple addition to Control.Arrow

dag.odenhall at gmail.com dag.odenhall at gmail.com
Thu Jan 17 22:32:14 CET 2013


Should perhaps be noted that this exists in the lens package as "over both"
and also for up to 9-tuples as "over each".


On Tue, Jan 8, 2013 at 3:21 AM, Daniel Díaz Casanueva <dhelta.diaz at gmail.com
> wrote:

> 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
>>
>
>
> _______________________________________________
> 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/20130117/2ce6779b/attachment.htm>


More information about the Libraries mailing list