Proposal: Add &&& and *** to Data.Tuple
josef.svenningsson at gmail.com
Fri Sep 21 13:02:32 EDT 2007
On 9/19/07, Josef Svenningsson <josef.svenningsson at gmail.com> wrote:
> On 9/18/07, Benjamin Franksen <benjamin.franksen at bessy.de> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1776 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20070921/60d7d575/tuple2.obj
More information about the Libraries