[Haskell-cafe] How to understand the fmap here ?

Bulat Ziganshin bulat.ziganshin at gmail.com
Tue May 5 05:39:46 EDT 2009


Hello z_axis,

Tuesday, May 5, 2009, 1:27:16 PM, you wrote:

> floatLocation :: Window -> X (ScreenId, W.RationalRect)
>
> rr <- snd `fmap` floatLocation w
>
> class Functor f where fmap :: (a -> b) -> f a -> f b

looks ok. X===f, fmap executes

floatLocation w :: X (ScreenId, W.RationalRect)  ===  f a

and then applies

snd :: (ScreenId, W.RationalRect) -> W.RationalRect  ===  a->b

to result, so that entire (snd `fmap` floatLocation w) has type

X W.RationalRect  ===  f b



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list