Proposal: Add &&& and *** to Data.Tuple

Twan van Laarhoven twanvl at gmail.com
Mon Sep 17 13:46:11 EDT 2007


Josef Svenningsson wrote:
> Hi all,
> 
> It is becoming increasingly popular to import Control.Arrow just to
> get access to the functions &&& and *** specialized to the function
> arrow. I propose to add the specialized version of these two functions
> to Data.Tuple which is more logical thing to import if you wish to
> have functions operating on tuples.

Other functions for which Arrow is often unnecessarily used are first 
and second
 > first :: (a -> b) -> (a,c) -> (b,c)
 > first f (x, y) = (f x, y)
 > second :: (a -> b) -> (c,a) -> (c,b)
 > second f (x, y) = (x, f y)

I think these should be added as well. I don't really like these names, 
but they are the names from Control.Arrow. The problem is that 'fst' and 
'first' are essentially the same, but they do different things. Maybe 
'mapFst' or 'updateFst' is a better name.

Twan


More information about the Libraries mailing list