Cale Gibbard wrote:
>> <Snip>
> So long as we're going to have a defaulting mechanism, it seems a bit
> odd to restrict it to Num, and to classes in the Prelude.
Instead of having literals such as 1 that could be Int, Integer, or Float
etc, why not just have one Number type declared as something like:
data Number = NInt Int | NInteger Integer | NFloat Float | NDouble Double |
NRational Integer Integer | NComplex Number Number
etc so that all numeric literals would just be translated by the compiler
into a Number. Arithmetic ops would then not be overloaded but the compiler
could hopefully optimize out the extra indirection caused by using Number
instead of plain Int, Integer, etc.
Regards, Brian.