
On Fri, Apr 02, 2004 at 10:39:19AM +0200, Robert Will wrote:
On Fri, 26 Mar 2004, Wolfgang Jeltsch wrote:
Hmm, than we have a different interpretation of the standard as far as (==) is concerned. Well, concerning Monad you're probably right because the Report only says "should" satisfy instead of "shall" satisfy or whatever. As far as I could see the Report says nothing about the meaning of (+).
Well, the next version of Haskell with Design by Contract will of course formally specify all those laws, so I won't be forced any more to pay attention to the difference between "shall" and "should". The sense of the latter being surely questionable, since a law that doesn't always hold, is not a law, but a hidden bug.
It may seem a bit late that FP now gets, what has been into imperative practice in 1985. (Bibliography on http://www.stud.tu-ilmenau.de/~robertw/eiffel )
I know of at least a few cases where formal laws do not actually hold. * Associativity of floating-point addition (etc.) This does cause problems in practice, as any numerical analyst will tell you. * A monad provided with a random number generator, which you could think of as an infinite list of Int's. The associativity law does not hold: each computation will get its own random bits, but they will be different random bits depending on which way you associate. I'm sure there are other useful examples where formal laws do not quite hold. Peace, Dylan