[Haskell] Exceptions

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Tue Nov 23 10:51:49 EST 2004


in the following example, the handler won't catch the exception
because of lazy evaluation. therefore, it's a different story
than with exceptions in ML, Python, whatever strict language.

main = do
     xs <- return [ 1, 2, error "throw" ]
         `catch` \ any -> do
             putStrLn "caught"
	    return [ 4, 5, 6 ]
     print xs
-- 
-- Johannes Waldmann,  Tel/Fax: (0341) 3076 6479 / 6480 --
------ http://www.imn.htwk-leipzig.de/~waldmann/ ---------



More information about the Haskell mailing list