Wolfgang Jeltsch protests (all this is about pathologies of the floating point computations in Haskell, of course...):
Please don’t suggest that “illegalizing” some Ord instance is similar to killing people out of religious motives.
Did I? Where?? This is silly... I admit that I have over-reacted to Ketil, I didn't notice that he proposed the "bombing reaction" as an *option*, not as the Only True way of dealing with NaNs. I am sorry, although then Ketil seems saying that raising the exception *is* the correct approach, while I think it is not, being too brutal. OK, probably the best for people who learn the language. No good for professionals, and impossible for some library procedures. But *you* seem to have decided that all "weakness" in treating exceptional values is absolutely wrong and sinful. The analogy with religious issues is weak, there is simply a thought pattern of "purists" who want to break the existing imperfections in name of their visions. You demonstrate this kind of absolute thinking through the usage of the clause "as a whole":
Even if I don’t use numerics, I do care about the Haskell language as a whole.
Your name is Legion... But I think that Lennart is right. *DO* something positive. In other terms, instead of destroying an existing church, gather some followers, and make your own. Seriously. No type Double, but something possessing variants: * Float2 (regular) * UnderF (non-normalizable, underflow fl.p.) * PositiveInfinity | NegativeInfinity * NaN Mantissa [where Mantissa is a restricted numerical thingie, their number is the no. of floats between 0.5 and 1] etc. With appropriate arithmetic operators. And if you are unhappy with: blah>blah = False, but: compare blah blah giving GT, please tell what do you think SHOULD be the answer. I say that those operators are being used outside their allowed domain. Any answer is bad. Exception? Maybe... Better: leave it... But anyway, I don't buy this:
if (==) yields false when comparing a value with itself, this can break code (like a set implementation) which relies on certain guarantees.
In pathological cases you are not allowed really to use the word "itself" as casually as you would like to. I agree that
The fact that Haskell allows to define (==) rather arbitrarily doesn’t mean that the use of arbitrary definitions of (==) is what we want.
The problem of equality/identity of things relies partially in the fact that it is a human construction. The Nature does not "compare things for equality". So, the arbitrariness is unavoidable.
My impression is that staying close to math is good from a software technology point of view. And it has the advantage of less confusion for the user.
What does it mean "close to math"? How close? Does math raise exceptions upon the division by zero? Does *MATH* answer the question what is: (0/0)==(0/0) ? Nope! David Roundy says ...
Prelude> x/x NaN
The "true" answer here is that x/x == 1.0 (not 0 or +Infinity), but there's no way for the computer to know this, so it's NaN.
His comment uses not very legally the word "true", even in quotes. Who is to say what the "truth" mean here? We cannot oblige the computer to interpret the division operator as we think, in math terms! Wherever you look, you will see some red lines not to neglect. If the physical processes which implement real arithmetics are far from true real math, trying to purify a programming language to make it more math- oriented serves nobody. Or the Devil... We are discussing simple things, but I have seen already a guy who claimed that all computer logic is inherently wrong because of the Gödel's theorem... This is a neverending discussion.
I don’t see what’s so extreme about suggesting that IEEE floating point comparison should maybe be a seperate operator.
You were more picky than that. Here, I would only repeat that this - for me - is not just a question of operators, but of the *type* of numbers.
And I think, it is really inappropriate to compare this to horrible sects and doctrines.
Ugh... Again. Sorry if you took it personally. But a doctrine is just that, a system which is meant to be autoritative, and if applied, then without discussion. Usually based on personal visions of one or a few people. It doesn't need to be negative nor horrible, although often is. http://en.wikipedia.org/wiki/Doctrine I mentioned a particular variant of doctrinal thinking: the *purification* of existing. It doesn't need to be dangerous, but often is... ==== An anecdote. At the time of Konrad Duden (Vater der deutschen Rechtschreibung, 1829–1911 as you probably know much better than I...) there was a tendency to "purify" the German language, full of foreign words, roots, forms, etc. There is a story of one of such words, the shortwriting: "stenography". Stenografie. Who needs Greek? And a good Germanic word has been proposed: Kurzschrift. Yes! Please - (if you are not German, they don't need to do that) - repeat a few times: Kurzschrift, Kurzschrift, Kurzschrift, Kurzschrift ... You will hear the Walkyrien galloping through the skies, the huge shadow of Siegfried or some other Lohengrin will lie over the murky fields, etc. *absolutely* Germanic! But... This word comes from "curtus", "short" in Latin, and the verb "scribere", "scriptus", Latin again... In such a way, German purists translated Greek into Latin. This is the story, I hope nobody will shout that I have something against a particular European nation; I know this story from a decent Berliner, who told me it while eating a Hamburger. Or, perhaps it was vice-versa. Too much beer... Jerzy Karczmarczuk _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe