Proposal: Add Eq instance for Control.Exception.ErrorCall
Edward Kmett
ekmett at gmail.com
Tue Nov 27 16:30:31 CET 2012
There are a number of other data types in that module that have a similar
construction IIRC, such as AssertionFailed, NoMethodError,
PatternMatchFail, RecConError, RelSelError, etc. which should probably pick
up Eq, Ord for consistency (and become newtypes).
and a few others that can have the obvious trivial, empty Eq, Ord like
NonTermination, NestedAtomically, BlockedIndefinitelyOnMVar.
The module is currently a bit ad hoc about which types support Eq and Ord.
For instance, ArrayException already supported this kind of Eq/Ord, and all
the multiple constructor versions did, but none of the single-constructor
trivial versions and only some of the reasonable-to-newtype ones.
-Edward
On Tue, Nov 27, 2012 at 8:57 AM, Simon Marlow <marlowsd at gmail.com> wrote:
> On 27/11/12 10:59, Simon Hengel wrote:
>
>> Hi,
>> I propose to add an Eq instance for ErrorCall. The main motivation is
>> to make it more convenient to construct predicates that select specific
>> exceptions.
>>
>> My current use case is testing for expected exceptions. In Hspec[1] we
>> use predicates for that, e.g.:
>>
>> evaluate (head []) `shouldThrow` (== ErrorCall "Prelude.head: empty
>> list")
>>
>> But I think it can be useful in other situations and it is consistent
>> with the fact that other common exception types have an Eq instance
>> (e.g. ArithException, IOException, ExitCode).
>>
>> Discussion period: 3 Weeks
>>
>
> Already did it, a few weeks ago:
>
> http://www.haskell.org/**pipermail/cvs-libraries/2012-**
> October/016043.html<http://www.haskell.org/pipermail/cvs-libraries/2012-October/016043.html>
>
>
> Cheers,
> Simon
>
>
>
> ______________________________**_________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/**mailman/listinfo/libraries<http://www.haskell.org/mailman/listinfo/libraries>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20121127/4da600f5/attachment.htm>
More information about the Libraries
mailing list