Proposal: Add Eq instance for Control.Exception.ErrorCall
Henning Thielemann
lemming at henning-thielemann.de
Tue Nov 27 14:07:21 CET 2012
On Tue, 27 Nov 2012, Simon Hengel wrote:
> 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 ;)
My advice to programmers is: If you are starting to document insane
behavior, wait a minute and think about how to avoid it. In many cases
this helps. :-) Having said that you might assist the users of hspec by
providing variants of shouldThrow, say shouldCallError, that matches error
messages. Additionally I would add a DEPRECATE pragma to shouldCallError
with a message that tells the programmer that he should think twice.
More information about the Libraries
mailing list