[Haskell-cafe] Num instances for 2-dimensional types
ok at cs.otago.ac.nz
Tue Oct 6 17:40:35 EDT 2009
On Oct 6, 2009, at 3:49 AM, Lennart Augustsson wrote:
> But complex numbers are just pairs of numbers. So pairs of numbers
> can obviously be numbers then.
The basic problem here is that pairs of numbers can be made
to fit into the Haskell framework with more than one semantics.
For example, historically one use for a pair of floating point
numbers was to get twice the precision. You implement the operations
for that use very differently from the use as complex numbers.
If you *know* what you want each of the operations to mean,
go ahead. If you don't know, if you have to define some operation
just to satisfy the typeclass requirements, and aren't sure what
to do in some case, you probably shouldn't use that typeclass.
More information about the Haskell-Cafe