State of DData

Wolfgang Jeltsch wolfgang at jeltsch.net
Fri Mar 26 15:04:08 EST 2004


Am Freitag, 26. März 2004 14:34 schrieb Simon Marlow:
> > > > In my opinion, even "advanced users" should adhere to The
> > > > Haskell Report which says that (==) means equality.
> > >
> > > Where does the report say that?  As far as I can see, the closest quote
> > > is this:
> > >
> > >    The Eq class provides equality (==) and inequality (/=) methods.
> > >
> > > (section 6.3.1).  The report doesn't explicitly say anywhere that any
> > > assumptions about the properties of == are ever made.
> >
> > If the Report calles (==) an equality method then (==) should
> > implement equality for every Eq instance.
>
> Arguably then, anything which is an instance of Monad should be a monad.

Of course.  But a monad is AFAIK just defined as something that fulfills 
certain laws, so everything that fulfills those laws is a monad.

> And '+' should be addition.  etc. etc.

Yes, I'd say that + should only be used for addition.  For example, C++ does a 
bad thing in misusing shifting operators for I/O, IMO.

> Haskell doesn't require any of these to be true, and similarly it
> doesn't require that every instance of '==' is equality.

Well, Haskell doesn't enforce these things.  But to my knowledge, the report 
makes it clear that a Monad instance should satisfy the monad laws.  And if 
the terms "equality method" and "inequality method" in the report don't mean 
that (==) and (/=) should implement equality and inequality respectively, 
than their presence in the Report is useless, isn't it?

> Cheers,
> 	Simon

Wolfgang

P.S.: By the way, could you make sure that the citiations in your e-mails 
aren't messed up? Thanks!



More information about the Libraries mailing list