Data.Tuple impoverished

Ross Paterson ross at soi.city.ac.uk
Fri Jun 15 13:28:23 CEST 2012


On Fri, Jun 15, 2012 at 11:25:56AM +0100, Herbert Valerio Riedel wrote:
> Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> writes:
> 
> >>  mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
> >>  mapFst :: (a -> c) -> (a, b) -> (c, b)
> >>  mapSnd :: (b -> c) -> (a, b) -> (a, c)
> >
> > I believe these are covered by Control.Arrow...
> 
> I'm not sure those are really equivalent, as the ones from
> "Data.Tuple.HT" use lazy pattern matching, e.g.:
> 
> mapPair ~(f,g) ~(x,y) = (f x, g y)
> 
> mapFst f ~(a,b) = (f a, b)
> 
> mapSnd f ~(a,b) = (a, f b)



More information about the Libraries mailing list