Proposal: Add Eq instance for Control.Exception.ErrorCall

Simon Hengel sol at typeful.net
Tue Nov 27 13:22:56 CET 2012


> How can you be sure that you get a certain error? Depending on the
> order of evaluation you might get different error messages if there
> are multiple possible ways to fail. I think automated testing
> against specific error messages will not work reliably.

If the function/value under specification is so "insane" that it
contains a /set of exceptions/, then you have to be prepared to get any
of those [1]:

  evaluate value
    `shouldThrow` (||) <$> (== ErrorCall "foo") <*> (== ErrorCall "bar")

Again, I'm not implying that it's a good idea to write a function that
behave like that.  But if you do, I'd at least like to have it
documented ;)
    
Cheers,
Simon

[1] http://research.microsoft.com/en-us/um/people/simonpj/papers/imprecise-exn.htm



More information about the Libraries mailing list