parsonsmatt / annotated-exception

Machinery for throwing and catching exceptions with some annotation.
BSD 3-Clause "New" or "Revised" License
32 stars 3 forks source link

Remove `Eq` constraint from `AnnC` #10

Closed parsonsmatt closed 2 years ago

parsonsmatt commented 2 years ago

Related to #9 where Show is problematic in AnnC, we can also probably drop the Eq constraint.

Eq is useful primarily in the test suite. I have run into some issues in the work codebase where deriving Eq ended up being a chore because SomeException does not have an Eq instance (and while you can hack one in with a a == b = show a == show b, it's not great).

The main utility of an Annotation is not comparing it with another, it is rendering it into a value that can be used intelligently in your error reporting behavior. So converting to String as a last resort makes sense, but doing Eq is less defensible.