Revamping the numeric classes

Dylan Thurston
Tue, 6 Feb 2001 16:58:25 -0500

On Tue, Feb 06, 2001 at 10:29:36PM +0100, Andreas Gruenbacher wrote:
> On Tue, 6 Feb 2001, Dylan Thurston wrote:
> > * (+) and (-) being lumped in with (*) (doesn't anyone use vector spaces?)
> That also causes me some headaches.
> ... Even for others, it might be scaling (s
> -> t -> t).
> It may be the case that using (*) for scaling too is a generally bad
> idea...

It may not be type sound to have the same operation, but there should
be some standard operation for scaling.  (Probably you need
multi-parameter type classes for this.)

> Another problem: The right place for fromInteger is probably not in class
> Num. One cannot use the remaining Num operations on everything one can
> construct from an Integer.
> Otherwise it would be possible to write `0' for different kinds of zero
> elements (and perhaps `1' for different one elements), even for things on
> a nominal scale.

When I thought about it, I concluded that '0' belongs with '+' and '-',
'1' belongs with '*', and 'fromInteger' belongs with their join (which
is mathematically called a Ring, but could keep the name Num).

	Dylan Thurston