Data.Ratio and exceptions

Simon Hengel sol at
Wed Jun 13 12:57:21 CEST 2012

> I'll go ahead and make this change.  Thanks for the suggestion!

I agree that ArithException feels more appropriate here.  But I make two

(1) It replaces specific error messages with less specific ones.

    The error message will not include the function/operator name
    anymore, e.g.:

    ghci> 1 % 0
    *** Exception: Ratio.%: zero denominator

    would become:

    ghci> 1 % 0
    *** Exception: divide by zero

(2) It is a breaking API change, and the complier won't help you to
    detect it in client code.

I'm not saying that this is a bad idea, I just try to understand what
the benefits of this breaking change are.  If it only gives us less
useful error messages, than I'm not convinced**.


** If we had stack traces with source locations that are enabled by
   default, I would be less reluctant to this change.

More information about the Libraries mailing list