[bitc-dev] Haskell question: exceptions
Jonathan S. Shapiro
shap at eros-os.org
Thu Aug 11 23:02:03 EDT 2005
On Thu, 2005-08-11 at 16:42 -0700, Iavor Diatchki wrote:
> Hmm... I am not sure which rule you are referring to. Could you post
> a link so that I can look at the details?
Actually, I cannot. I was repeating a statement made by Swaroop. I have
just spent some time looking for such a requirement within the
definitions of SML and O'Caml, and I cannot find one. So: let me back
Swaroop has noticed the following behavior in O'Caml that we cannot
Objective Caml version 3.08.3
# exception Xn of int;;
exception Xn of int
# try raise (Xn 10) with Xn n -> function x -> x;;
- : '_a -> '_a = <fun>
The weird part is that the assigned type is not:
- : 'a -> 'a = <fun>
Minor variations on this example *do* end up with 'a rather than '_a.
Swaroop: can you post the other cases to illustrate what is puzzling us?
So far as I can tell, there is no reason why ML-style exception handling
should have any effect on polymorphism. That is why we are puzzled.
Since my original question concerning Haskell exceptions, I *have* found
a conclusive statement that the only exceptions in Haskell are
restricted to the IO module, and that there is no generalized exception
mechanism within the language.
More information about the bitc-dev