At 10:11 -0700 2001/11/01, Alastair David Reid wrote:
"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.
I think that in the (denotational semantics) theory that Haskell (originally) relies on, errors are identified with non-termination, and it is not determinable to decide whether something is a non-termination. Thus, equations like 3/0 == 4/0 cannot de decided from that viewpoint: All one knows that if the values 3/0 and 4/0 are needed by "==", then they will be computed; but they then generate errors. The problem is that divide-by-zero is not represented as a _value_, or not all closures can be treated as values. It would be fully possible to give 3/0 and 4/0 values: In math, suppose we choose a projective space P^1, they would have the same value infinity value oo. An alternative approach is to let them produce an exception, which can be picked up. This way to can let n/0 have say a projective value by redefining "/": a thrown divide-by-zero is caught and converted to a special oo value. Hans Aberg