Lennart about the power operator (I don't remember who
posed the question...):

> Maybe you
> should use (^^) instead, it is defined the way you suggest.
> Or perhaps (**) which works on almost any number type.
                                  ********************
> 
> Maybe you should have a look in the Haskell Prelude to see
> what's available?


Sorry, (**) needs the Floating instance, it is exp (log x * y).

The problem of various numbers and related operators is still there. 
I have defined and used log, exp. etc. for other kind of beasts, not 
only floating-point numbers. (For example for infinite power series with 
coefficients belonging to any reasonable Field, including Rational,
with condition that the constant term vanished...). You can imagine
what kind of gymnastics this required.


<<Caeterum censeo>> that the number of people thinking that the Num 
hierarchy in Haskell is - to say it mildly - not a perfect solution, 
is growing fast!
and that the categorial hierarchies will reappear like Nessie every month
until the Gurus recognize the need for standardisation. Dixi.

Another question and Lennart's answer.

*> So I gues my real question should be:  Why does Num not require Ord?

> Because some numbers are not ordered, e.g. complex numbers.

Sure. And why do Numbers require Show? This is a silly question, but
not-so. You can implement in Haskell all kind of horrible "numbers",
for example the Church-Peano arithmetic with numbers being functional
objects (parametrized by the abstract "zero" and the abstract successor).
Of course, it is nice to see their external representation, but this
has nothing to do with the fact of being an arithmetic entity.

Have a nice Easter.

Jerzy Karczmarczuk
University of Caen, France.





  • 2^(-1) Jeff P. Burdges (Weasel)
    • Re: 2^(-1) Lennart Augustsson
    • Jerzy Karczmarczuk

Reply via email to