"Sohrab" == Sohrab Saran
writes: If at the Hugs interpreter prompt I type: 3/4 == 3/4 ...I get "True" If I now type: 3/0 == 3/0 ...I should get "True" but I get a divide-by-zero error instead. Anyone ready to fix this, or should I fix this myself?
I don't believe this is a bug.
Suppose we adopt your proposal, I think we'd also want to add the following equalities too:
1. f 3 == f 3 = True
2. f 3 == g 3 = True where g x = f x
3. f 3 == g 3 = True where g x = x / 0; f x = x / 0
4. f 3 == g 3 = True where g is semantically equivalent to f
The problem with this is that it's hard to say why we'd accept 1-3 but not accept 4 and accepting 4 requires us to solve the halting problem.
I think you're missing the point - the original poster wants 3/0 to have a non-bottom value, namely Infinity, which would make the equality hold. This works in GHCi, because we choose to represent floating point exceptions with the special values Infinity and NaN, but a Haskell implementation isn't required to do this (see section 6.4 in the report). Personally I think GHC's behaviour is preferrable because it more closely matches the IEEE standard and other languages. Cheers, Simon
participants (1)
-
Simon Marlow