[Haskell-beginners] tuple update

Brent Yorgey byorgey at seas.upenn.edu
Fri Mar 9 22:29:49 CET 2012


Actually it's second that is fmap.

Prelude> :m +Control.Monad.Instances Control.Arrow
Prelude Control.Monad.Instances Control.Arrow> fmap (*2) (1,3)
(1,6)
Prelude Control.Monad.Instances Control.Arrow> second (*2) (1,3)
(1,6)

-Brent

On Fri, Mar 09, 2012 at 07:23:50PM +0000, Thomas Davie wrote:
> first ofc also being known as fmap.
> 
> Bob
> if (*ra4 != 0xffc78948) { return false; }
> 
> On 9 Mar 2012, at 19:09, Brent Yorgey wrote:
> 
> > On Fri, Mar 09, 2012 at 09:07:24PM +0200, Ovidiu Deac wrote:
> >> Does anybody know if there are any functions like these in the Haskell
> >> libray?
> >> 
> >> updateSnd f (x,y) -> (x, f y)
> >> 
> >> updateFst f (x,y) -> (f x, y)
> > 
> > Yes: 'first' and 'second' from Control.Arrow.
> > 
> > -Brent
> > 
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
> 



More information about the Beginners mailing list