
1 Jul
2011
1 Jul
'11
8:48 p.m.
Try this:
mapM (\x -> getDeviceInfo x >>= print . name) [0..10]
2011/7/1 Dennis Raddle
It's been about a year since I used Haskell and I'm rusty. I think I knew how to do this once, but I need a reminder.
I've got some functions:
getDeviceInfo :: Int -> IO DeviceInfo
name :: DeviceInfo -> String
I want to do something like
func :: IO () func = do ds <- mapM getDeviceInfo [0..10] mapM_ (print . name) ds
Is there a way to combine 'getDeviceInfo', 'name', and 'print' in one line?
Dennis
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners