About "Why does the code below not throw an exception?":
io :: IO ()
io = catch (return t) (\e -> putStrLn $ myExToString e)
main = io >>= print
It printthrows an exception if it forces you to tevaluate, but at that time there isnβt catch. Try instead:
io :: IO ()
io = catch (return t >>= print) (\e -> putStrLn $ myExToString e)
-- or simply: catch (print t) (\e -> ....)
main = io
source
share