
2 Jul
2011
2 Jul
'11
3:55 a.m.
On Fri, Jul 1, 2011 at 10:48 PM, Alexey G
Try this:
mapM (\x -> getDeviceInfo x >>= print . name) [0..10]
Though they're not very well known, Control.Monad now contains "composition" monad operators, so you can just write :
mapM_ (getDeviceInfo >=> print . name) [0..10]
which is pretty elegant (to my eyes at least). (>=>) :: (a -> m b) -> (b -> m c) -> a -> m c -- Jedaï