Create a dedicated `TypeError` exception type
Ticket #10283 (closed) discusses using
-fdefer-type-errors to test that certain programs do not type check.
In practice, this involves evaluating certain expressions to WHNF at run-time can checking whether they trigger an exception. Currently, it seems the exception to catch is an
ErrorCall exception. It would be nice if we could very specifically catch type errors though. It's entirely possible that a critical test case that I want to be a type error mistakenly type-checks and then calls
error. In such a situation, it's hard to distinguish such a true run-time error from a deferred type error. It would be much nicer if something like
TypeError would be thrown instead of
Yes, it's currently possible to look at the text of the
ErrorCall and check for certain text fragments in there, but that sounds extremely fragile to me.