
Does the bias matter at all if Eq means equality?
It should be documented, so "advanced users" can rely on the behaviour.
In my opinion, even "advanced users" should adhere to The Haskell Report which says that (==) means equality. Content-Transfer-Encoding: quoted-printable
Contrived example:
data Foo =3D Foo Int Int
instance Eq Foo where
(Foo x _) =3D=3D (Foo y _) =3D x =3D=3D y
mkFoo x =3D Foo x (expensive_calculation x)
fooX (Foo x _) =3D x
fooY (Foo _ y) =3D y
a =3D mkFoo 10
b =3D mkFoo 10
=
m =3D if fooY a > 10 then add a empty else empty
m' =3D add b m
Now it would be nice to know that a is in the collection, not b, because =
a's Y component has been forced, but b's hasn't. Replacing a with b woul=
d waste work.
Thus knowing the bias may be important for time/space analysis.
--KW 8-)
-- =
Keith Wansbrough