Hi Jan,
| ... I realized that
| there are several quite annoying problems with Haskell numerical
| types and classes.
| ...
| + Hugs is supplied with the type Number. According to its
| author: "Fixed width integers with overflow detection.. Unlike
| Int, overflows are detected and cause a run-time error...
| A fairly messy hack, but at least it works...".
|
| My comment is that the chosen name "Number" is here a very
| unfortunate choice: it suggests generality, but in fact this
| is just only a better Int.
Please don't blame Haskell for the Number library; it isn't part
of any Haskell standard.
The author that you refer to is me, and the program was, as the
comment suggests, nothing more than a quick hack. I originally
included it in the Hugs distribution Hugs in the hope that it might
be useful to someone, perhaps more as an example using restricted
type synonyms than as a practically oriented library. And it's
lurked there ever since. I'm concerned that people might mistake
such things as anything more than this.
As for the name, the library was originally intended to provide
something more like Miranda's numeric datatype, incorporating
floating point and integer values. Adding two large integers
would then result in a change of representation rather than an
overflow. So the first step was to detect overflow. I never
got around to the next step ... you might want to try it yourself,
possibly incorporating complex numbers too. In any case, that's
why it was called "Number".
Finally, I think there is a general warning in the Hugs documentation
that Hugs is not really suitable for numeric work. For example, the
default representation of both single and double precision floating
point numbers is single precision ... in both cases. This may/will
change in future incarnations, I just don't want you to get the wrong
impression now.
Hope this clears things up!
All the best,
Mark