[Haskell-cafe] Re: A question about "monad laws"
Jonathan Cast
jonathanccast at fastmail.fm
Mon Feb 11 11:00:04 EST 2008
On 11 Feb 2008, at 7:52 AM, Arnar Birgisson wrote:
> Hi all,
>
> On Feb 11, 2008 3:14 PM, apfelmus <apfelmus at quantentunnel.de> wrote:
>> I will be mean by asking the following counter question:
>>
>> x + (y + z) = (x + y) + z
>>
>> is a mathematical identity. If it is a mathematical identity, a
>> programmer need not care about this law to implement addition + . Can
>> anyone give me an example implementation of addition that violates
>> this law?
>
> Depends on what you mean by "addition". In general, algebraists call
> any associative and commutative operation on a set "addition", and
> nothing else. From that POV, there is by definition no "addition" that
> violates this law.
I agree. The Num Double instance should be expelled from the Prelude
immediately.
jcc
(What? Haskell has a Float type?)
More information about the Haskell-Cafe
mailing list