[Haskell-beginners] mapM etc.

Dennis Raddle dennis.raddle at gmail.com
Fri Jul 1 22:08:43 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110701/62dc31f7/attachment.htm>


More information about the Beginners mailing list