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

Benjamin Franksen benjamin.franksen at
Tue Sep 18 13:53:20 EDT 2007

Twan van Laarhoven wrote:
> 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.

'onFst' and 'onSnd' look nice to me:

onFst (+1) (1,'a') ==> (2,'a')


More information about the Libraries mailing list