[Haskell-cafe] Re: Numeric type classes

Henning Thielemann lemming at henning-thielemann.de
Tue Sep 12 11:12:34 EDT 2006


On Mon, 11 Sep 2006, Ross Paterson wrote:

> On Mon, Sep 11, 2006 at 04:26:30PM +0200, Henning Thielemann wrote:
> > On Sat, 9 Sep 2006, Ross Paterson wrote:
> > > I think that a finer grain numeric hierarchy, while retaining Num, etc,
> > > is feasible without changing the language: unlike the case of monads,
> > > the people who will be defining instances of numeric classes are the
> > > very ones who are inconvenienced by the current hierarchy.  The main
> > > impact on clients of the classes is that some functions would have
> > > more general types.
> > 
> > There are many Num instances around in libraries where people wrap to
> > external libraries: functionalMetapost, CSound wrapper in Haskore,
> > SuperCollider (GSL too?). What about Num (algebraically Ring) instances of
> > polynomials, residue classes and other such advanced mathematical objects?
> 
> And what do abs and signum mean for Haskore's orchestra expressions,
> polynomials, residue classes, vectors, matrices, functions, etc?

For clarification: Haskore does not define any arithmetic for music, but
CSound provides some arithmetic and Haskell wraps it with Num instances.

> The people who define those wish they were defining Ring, but they must
> define Num.

It seems we are at a point, where we have to define what is a 'number'.  
More precisely: Can you tell me the difference between numbers and "more
complex mathematical objects"? Is a complex number a number? Is a
quaternion a number? Is a residue class a number? We can calculate with
integers modulo some other integer like with integers - is that considered
computation with numbers? Shall we distinguish between matrices of numbers
and matrices of more complex mathematical objects? In signal theory
matrices of polynomials are very common.


More information about the Haskell-Cafe mailing list