
On 9/19/07, Josef Svenningsson
On 9/18/07, Benjamin Franksen
wrote: Twan van Laarhoven wrote:
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')
I omitted first and second from my proposal exactly because I didn't like the names. But onFst and onSnd sounds really nice. I'd be willing to include them in the patch if there is a general agreement about it.
I have updated the patch to also include onFst and onSnd. It's attached. Cheers, /Josef