
22 Jul
2003
22 Jul
'03
2:18 p.m.
On Tue, Jul 22, 2003 at 02:59:12PM +0100, Bayley, Alistair wrote:
handler :: Dynamic -> IO () handler e = do case (fromDynamic e) of Nothing -> putStrLn ("dynamic cast failed") Just (MkExc n s) -> putStrLn ("exception: " ++ (show n) ++ " " ++ s)
main :: IO () main = catchDyn temp handler
You're catching a Dynamic wrapped as a Dynamic (catchDyn already does fromDynamic, as indicated by its type). Change the handler to
handler :: MyException -> IO () handler (MkExc n s) = putStrLn ("exception: " ++ (show n) ++ " " ++ s)
any other dynamic exception fails through to the top level.