[Haskell-cafe] Monad laws

Mike Meyer mwm at mired.org
Sun Jun 29 23:29:16 UTC 2014


On Sun, Jun 29, 2014 at 6:05 PM, Alexander Solla <alex.solla at gmail.com>
wrote:

>
>> Is x == x being false really any more surprising than x + 1  == x being
>> true?
>>
>
> Yes, a lot more.  Equality is a symmetric relation.  So "x equals x" is
> true for every x.  A logic/language in which that is not true is unsound.
>
> x + 1 == x is just an equation.  Coming up with a theory where it holds is
> straightforward.  For example, addition followed by the "fractional part"
> operation, on the set [0,1].
>

Your theory is wrong. This is the same problem you run into with "x == x"
being False: you create theories from assumptions about how these things
behave based on your experience with abstract mathematical objects, and
there are values for which those assumptions do not hold. Surprise results
when you run into those cases.

IEEE 754 floats under + and * are *not* ℝ. Or even ℚ. They just play them
in the computer. There are simple large subsets of possible operands for
which addition (and hence the other three operators) doesn't work like the
mathematical realities they model.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140629/fce86a6f/attachment.html>


More information about the Haskell-Cafe mailing list