
5 May
2009
5 May
'09
5:35 a.m.
2009/5/5 z_axis
The following code snippets is from xmonad: -- Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. floatLocation :: Window -> X (ScreenId, W.RationalRect) --....... rr <- snd `fmap` floatLocation w
Prelude> :i fmap class Functor f where fmap :: (a -> b) -> f a -> f b
It seems it is different from the definition of fmap ? sincerely!
X is a Functor (and a Monad). floatLocation w :: X (ScreenId, W.RationalRect) -- i.e. f is X and a is (ScreenId, W.RationalRect) snd :: (ScreenId, W.RationalRect) -> W.RationalRect fmap :: (same as snd) -> X (ScreenId, W.RationalRect) -> X W.RationalRect Makes sense ? Cheers, Thu