Data.Tuple impoverished

Herbert Valerio Riedel hvr at gnu.org
Fri Jun 15 12:25:56 CEST 2012


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