[Haskell-cafe] ANNOUNCE: approximate-equality 1.0 -- Newtype wrappers for approximate equality

Felipe Lessa felipe.lessa at gmail.com
Tue Aug 3 06:39:02 EDT 2010

On Tue, Aug 3, 2010 at 7:27 AM, Neil Brown <nccb2 at kent.ac.uk> wrote:
> I like the look of this.  Eq and Ord instances that use epsilon values look
> like they will be handy.  I have a design question/suggestion.  You have:

What properties does Eq need to obey?

Reflexivity: (a == a)
Symmetry: (a == b)  ==  (b == a)
Transitivity: ((a == b) && (b == c)) == (a == c)

An instance using epsilon values clearly is reflexive and symmetric,
but it is not transitive.

I've looked [1] and appearently Eq doesn't list the laws it should
satisfy, not even '(a == b) == not (a /= b)' is mentioned.

[1] http://haskell.org/ghc/docs/6.12.1/html/libraries/base-

Cheers, =)


More information about the Haskell-Cafe mailing list