On 9/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
G'day all.

Quoting Henning Thielemann <[EMAIL PROTECTED]>:

> More precisely: Can you tell me the difference between numbers and "more
> complex mathematical objects"?

Yes.  A Num is anything which supports the common mathematically-
significant operations which are supported by the basic built-in machine
types such as Int and Double.  It need not _be_ a built-in machine type,
but it must support those operations.

And as an example of something which is useful as an instance of num
but isn't a number I have a recent experience I can share.

I was making an embedded domain specific language for excel
spreadsheet formulas recently and found that making my formula
datatype an instance of Num had huge pay offs.  You write formulas in
haskell code and then to turn them into something excel can chew on
you only need to show them.  I can even use things like Prelude.sum to
add up cells.  All I really needed was to define Show and Num
correctly,  neither of which took much mental effort or coding tricks.
Now I get tons for free.

Jason
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to