This is an inconsistency that was fixed in the revised Haskell98 report (Apr 2001). See http://research.microsoft.com/~simonpj/haskell98-revised
In the bug list look for Page 90. It looks as though Hugs hasn't quite caught up with this change. Simon | -----Original Message----- | From: Brian Huffman [mailto:[EMAIL PROTECTED]] | Sent: 22 March 2002 00:22 | To: [EMAIL PROTECTED] | Subject: catch (fail "...") | | | Hi, | | Here is a problem I came across recently, revealing a | difference between ghci | and Hugs: | | hugs> catch (error "not ok") (\e -> putStrLn "ok") | Program error: not ok | ghci> catch (error "not ok") (\e -> putStrLn "ok") | *** Exception: not ok | | hugs> catch (ioError (userError "not ok")) (\e -> putStrLn "ok") | ok | ghci> catch (ioError (userError "not ok")) (\e -> putStrLn "ok") | ok | | hugs> catch (fail "not ok") (\e -> putStrLn "ok") | Program error: not ok | ghci> catch (fail "not ok") (\e -> putStrLn "ok") | ok | | As I expected, neither of them can catch "error", and both of | them can catch | "ioError". But only ghci can catch the "fail". It seems to me | that ghc has | made a convenient choice here, because if I need to raise an | IO exception, it | is easier to type "fail s" than "ioError (userError s)". | | However, the online Haskell report says that for IO, fail s = | error s, which | is what Hugs does. | (http://www.haskell.org/onlinereport/standard-prelude.html#$iM onad$$IO) Does anyone know the reasoning behind the design choice made in the report, or why the ghc implementation is different? I am mainly concerned about portability issues: particularly, is it a good idea to use fail for raising IO exceptions? Thanks - Brian Huffman _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell