Skip to content

Instantly share code, notes, and snippets.

@b20n
Created May 5, 2012 02:14
Show Gist options
  • Save b20n/2599108 to your computer and use it in GitHub Desktop.
Save b20n/2599108 to your computer and use it in GitHub Desktop.
processDevice :: FilePath -> IO Int
processDevice fp = do
contents <- readFile $ fp ++ "/size"
return $ read contents
main = do
files <- getDirectoryContents "/sys/block/sda"
print $ map processDevice files
-- blockdevice.hs:33:2:
-- No instance for (Show (IO Int))
-- arising from a use of `print' at blockdevice.hs:33:2-6
-- Possible fix: add an instance declaration for (Show (IO Int))
-- In the first argument of `($)', namely `print'
-- In the expression: print $ map processDevice files
-- In the expression:
-- do { files <- getDirectoryContents "/sys/block/sda";
-- print $ map processDevice files }
-- Failed, modules loaded: none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment