2009/5/5 z_axis <z_a...@163.com>: > 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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe