Data.Ratio and exceptions

wren ng thornton wren at freegeek.org
Thu Jun 14 03:27:28 CEST 2012


On 6/13/12 6:57 AM, Simon Hengel wrote:
>> I'll go ahead and make this change.  Thanks for the suggestion!
>
> I agree that ArithException feels more appropriate here.  But I make two
> observations:
>
> (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

That's no good. I wonder whether ArithExceptions should be given their 
code location a la assertion failures[1]. Probably all the built-in 
exception types should do so.


[1] http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/assertions.html

-- 
Live well,
~wren



More information about the Libraries mailing list