<div dir="ltr"><div><div><br></div>Here's a small program that replicates the compilation issue I'm seeing:<br><br>import qualified System.Posix.Files<br><br>get_size :: String -> IO Integer<br>get_size filename = do<br>    file_status <- System.Posix.Files.getFileStatus filename<br>    let file_size = System.Posix.Files.fileSize file_status<br>    let integer_file_size = fromIntegral file_size<br>    return integer_file_size<br><br>main :: IO ()<br>main = do<br>    let filenames = ["/etc/services"]<br>    let sizes = map get_size filenames<br>    mapM_ print sizes<br><br></div>The compilation error I get is:<br><br>ghc -Wall --make -o stat2 stat2.hs<br>[1 of 1] Compiling Main             ( stat2.hs, stat2.o )<br><br>stat2.hs:15:11:<br>    No instance for (Show (IO Integer)) arising from a use of `print'<br>    Possible fix: add an instance declaration for (Show (IO Integer))<br>    In the first argument of `mapM_', namely `print'<br>    In a stmt of a 'do' block: mapM_ print sizes<br>    In the expression:<br>      do { let filenames = ...;<br>           let sizes = map get_size filenames;<br>           mapM_ print sizes }<br>make: *** [stat2] Error 1<br><br clear="all"><div><div>I've googled quite a bit, and guessed quite a bit, and added type declarations some, but I'm still not converging on a solution.<br><br></div><div>Why can't I print an IO Integer?<br><br></div><div>Thanks!<br><br></div><div>-- <br><div class="gmail_signature">Dan Stromberg</div>
</div></div></div>