Jan Skibinski  <[EMAIL PROTECTED]>  wrote on 2 Aug 1998 

(Subject:  Rambling on numbers in Haskell)


> ... I realized that there are several quite annoying problems with 
> Haskell numerical types and classes.
> ...
>  Yet again - as it has happened with other languages, someone
>  has decided that complex numbers are somehow not as important
>  as other numbers. At least Haskell acknowledges that they exist,


Not only Complex but the Real numbers too are impossible to be presented
adequately algorithmically. 
In this sense, they differ from Rational greatly.
Therefore, i propose for Haskell to name RealLike what it might call
Real, and ComplexLike - what it might call Complex.

On the other hand, Integer is indeed more important than Complex.
Because ComplexLike can be programmed easily via Integer.
  


> But where on Earth it is said that the domain of Complex numbers
> should be restricted to Float or Double? Why not Rationals as
> well?
> ... 
> Why is it that Maple, Matlab, Mathematica and other bunch of
> symbolic languages and also the calculators from the field of number
> theory can handle numbers smoothly without pestering the user with
> the messages of the kind "Int is not an instance of class 'Fractional'"?
> Are we becoming the slaves of the type system that you guys invented
> for some other, otherwise undoubtely important, reasons?


The main issue on  Maple, Matlab, Mathematica ... is that they are the
computer algebra systems.
And Haskell is an universal programming language and tool.
It would be more natural to write an application in Haskell which would
do what these CA programs do.
In particular, i am developing such a program 
(DoCon-1.07  <haskell.org/docon/> );  hope to release DoCon-2 this year.
Real and Complex (as Float) are not yet there, but, say, Rational-Complex,
Gaussian integers, and such, they are.


>... But I am sure there are plenty of Haskell afficionados with their 
> background in Number Theory that could made a serious revision of 
> numbers in Haskell. Time is probably right - considering that Haskell 2 
> is in its incubations stage.


I am going to suggest the more appropriate algebraic class hierarchy for 
Haskell-2. 
I wonder how lowd the community will start cussing.
This will touch the so-called numeric classes too
(Number classes are inside the Algebraic ones, but Haskell-1.4 somehow 
does not notice the difference at all).
For, probably, many people think that Haskell-2 has not to care for not 
breaking the Haskell-1.4 apllication code.


> Ideally, complex numbers should be incorporated somehow into
> basic numbers. I know, some purists would disagree, because
> Complex does not fit well into Ord class, but for me this is
> just a question of a definition or reorganization of classes.
> You can still somehow compare complex numbers - be it via
> magnitude or some other means. I would love to see sqrt (-1)
> producing complex answer, and not failing on me. I would like
> to have logaritms of negative numbers, arcsin's of x > 1, etc., etc.


`Complex' does not need the ordering (>).
Because it cannot agree well with (*).
But (>) is not necessary for incorporating of Complex.


Regards,


------------------
Sergey Mechveliani
[EMAIL PROTECTED]



Reply via email to