原帖由 sw2wolf 于 2009-5-5 08:35 发表
Prelude> :i fmap
class Functor f where fmap :: (a -> b) -> f a -> f b
Prelude> fmap (+1) [1,2,3]
[2,3,4]
Prelude> map (+1) [1,2,3]
[2,3,4]
好像与map没什么区别 ?
原帖由 sw2wolf 于 2009-5-5 14:52 发表
floatLocation :: Window -> X (ScreenId, W.RationalRect)
--.......
rr <- snd `fmap` floatLocation w
--....
这里的fmap如何理解呢?
原帖由 sw2wolf 于 2009-5-5 14:52 发表
-- 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
--....
这里的fmap如何理解呢?
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |