Revamping the numeric classes

Brian Boutel
Wed, 07 Feb 2001 18:27:02 +1300

Dylan Thurston wrote:

> These sound great to me.  If Haskell/2 is indeed open to such changes,
> would also be possible to revamp the numeric modules?  As a
> mathematician, I get annoyed by such things as
> * (+) and (-) being lumped in with (*) (doesn't anyone use vector spaces?)
> * the function 'atan2' being mixed in with a bunch of operations very
>   specific to the floating point format in the 'RealFloat' class.
>   Same problem (though less serious) with 'quot', etc., and
>   'toInteger' in the Integral class.
> * Superfluous superclasses: why are Show and Eq superclasses of Num?
>   Not all numeric types have decidable equality.  Think arbitrary
>   precision reals.

Haskell was intended for use by programmers who may not be
mathematicians, as a general purpose language. Changes to make keep
mathematicians happy tend to make it less understandable and attractive
to everyone else.


* most usage of (+), (-), (*) is on numbers which support all of them.

* Haskell equality is a defined operation, not a primitive, and may not
be decidable. It does not always define equivalence classes, because
a==a may be Bottom, so what's the problem? It would be a problem,
though, to have to explain to a beginner why they can't print the result
of a computation.