[Haskell-cafe] Monad laws
Mike Meyer
mwm at mired.org
Mon Jun 30 08:10:49 UTC 2014
On Mon, Jun 30, 2014 at 2:48 AM, Alexander Solla <alex.solla at gmail.com>
wrote:
> On Sun, Jun 29, 2014 at 4:29 PM, Mike Meyer <mwm at mired.org> wrote:
>
>> On Sun, Jun 29, 2014 at 6:05 PM, Alexander Solla <alex.solla at gmail.com>
>> wrote:
>>
>>> 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.
>>
>
> You can call it "wrong", but it doesn't make it so. (==) is supposed to
> model (witness) equality. The laws for Eq are the theory.
>
That is true, but what you said was "coming up with a theory where it [the
equation x == x + 1 being false] holds is straightforward. For example,
addition followed by ...".
Ah, I see. You're not trying to provide a theory as to why "floats" don't
behave like real numbers, but a mathematical operation which includes
objects that act like some "floats".
True, any sufficiently sophisticated developer won't have problems with x
== x + 1 being true. Then again, that's also true for x == x being false.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140630/e54792df/attachment.html>
More information about the Haskell-Cafe
mailing list