[Haskell] modern language design, stone age tools

MR K P SCHUPKE k.schupke at imperial.ac.uk
Thu Jun 24 06:54:29 EDT 2004


With reference to "mapException", I thought this seemed a good idea.
I like the 'AnnotatedException' idea... this is much better than
concatenating strings... However for not I thought I would test it
as is, but it doesn't work as I thought - perhaps someone could
point out where I have gone wrong.

1) this works:

main :: IO ()
main = do
   a <- getLine
   hPutStrLn $ showInt (fst . head . readDec $ a :: Int)
   `Exception.catch` (\e -> throw $ ErrorCall $ showString "Urk :" $ show e)

2) this doesn't work:

main :: IO ()
main = mapException (\x -> ErrorCall $ showString "Urk :" $ show x) $ do
   a <- getLine
   hPutStrLn $ showInt (fst . head . readDec $ a :: Int)


	Keean. (using GHC-6.2)


More information about the Haskell mailing list