Error Handling
Thomas L. Bevan
thomas_bevan@SoftHome.net
Mon, 9 Dec 2002 11:35:54 +1100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm writing a little command line app, but I have a question about error
handling. The code will go something like,
main = do (a:b:cs) <- getArgs
i <- return (read a :: Int)
j <- return (read b :: Int)
putStr $ i + j
How can I catch any possible cast exception? Ideally, I think I would like to
use the ErrorT monad as a means of handling a potentially fairly complex set
of inputs, but I can see no way of handling these errors neatly within that
monad.
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE98+VqGse0w80KF2gRAqnMAJ9CMiOWFS+3y2ELu7851MyvTb1aCgCgru+z
EtW/mO+WZ0lqtYUECcHyTDE=
=r1DY
-----END PGP SIGNATURE-----