On Mar 18, 2010, at 15:14 , Roderick Ford wrote:
... so, it looks like I am handling the IO wrong, or else I go directly to the exitWith instead of returning the IO from "return". So, I suppose this is normal behavior, but how do you do BOTH. I guess I should actually be "print"ing the output rather than returning it, then doing the exitWith.

The problem is you're not doing anything with the thing you're returning; if you turn on warnings you should get something about discarding an (IO String) which is the result of your "if" expression.

Normal behavior would be to send successful output to stdout and error output to stderr, so you would replace the first (return out) with (putStrLn out) and the second with (hPutStrLn stderr err); for the latter you'll also need to import stderr from System.IO.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to