[Haskell-cafe] Mystery of an Eq instance

Stijn van Drongelen rhymoid at gmail.com
Sat Sep 21 09:34:58 CEST 2013

I think you are trying to solve a problem that doesn't exist.

* Float and Double are imprecise types by their very nature. That's exactly
what people are forgetting, and exactly what's causing misunderstandings.
Perhaps(!) it would be better to remove the option to use rational literals
as floats, and require people to convert rationals using approx ::
(Approximates b a) => a -> b when they want to use FP math (instance
Approximates Float Rational, etc).

* Pure equality tests make perfect sense in a few situations, so Eq is
required. In fact, it's required to have an IEEE754-compliant

* As mentioned, there is a total order (Ord) on floats (which is what you
should be using when checking whether two approximations are approximately
equal), which implies that there is also an equivalence relation (Eq).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130921/3e7112d1/attachment.htm>

More information about the Haskell-Cafe mailing list