[Haskell-cafe] throwDyn typing "fun"

Einar Karttunen ekarttun at cs.helsinki.fi
Fri Nov 11 06:20:05 EST 2005


Hello

It seems that the type of throwDyn and throwDynTo are dangerously close.
ThrowDyn works in with any of the arguments of throwDynTo, which can
cause evil situations.

throwDyn :: Typeable exception => exception -> b

Which means e.g. "throwDyn someThreadId SomeException" will work 
when you wanted to say "throwDynTo someThreadId SomeException"
and they both have types which unify with IO ().

I think using a
class Typeable => DynamicException a where ...
and throwDyn :: DynamicException a => a -> b
could make more sense.

- Einar Karttunen


More information about the Haskell-Cafe mailing list