
On Tue, Mar 20, 2007 at 03:53:58PM +0000, Malcolm Wallace wrote:
Ian Lynagh
wrote: (D# x) `compare` (D# y) | x <## y = LT | x ==## y = EQ | otherwise = GT
becomes
(D# x) `compare` (D# y) | x <## y = LT | x ==## y = EQ | x >## y = GT | otherwise = error "Incomparable values"
I'm pretty uncomfortable with calling 'error' in this situation. How about throwing an imprecise exception instead?
Doesn't error throw an imprecise exception? We already have things like remInteger ia ib | ib == 0 = error "Prelude.Integral.rem{Integer}: divide by 0" We could throw (ArithException something) instead if that's what you mean, but I think we'd need a new constructor for something. I'm not sure if it should be an ArithException or not. (should remInteger above throw (ArithException DivideByZero)? We'd give a less useful message to the developer, but have something possibly more useful to catch. I've wished for exceptions to have a stack of locations in the past; perhaps that should be another proposal.) Thanks Ian