
On Sun, 22 May 2005 ajb@spamcop.net wrote:
Quoting Ashley Yakeley
: 2. This one is more familiar for the English language and for the standard operators:
add :: Absolute -> Diff -> Absolute add a d = a + d subtract :: Absolute -> Diff -> Absolute subtract a d = a - d diff :: Absolute -> Absolute -> Diff diff a b = a - b
But even better would be if you could do both, and not distinguish between subtract and diff:
I assume that these function are for computations like subtract :: DegreeCentigrade -> Kelvin -> DegreeCentigrade diff :: DegreeCentigrade -> DegreeCentigrade -> Kelvin and the intentions are different enough to implement distinct functions. I assume that there will be an implementation for 'diff' whenever there is one for 'subtract' and vice versa, thus considering them as different instances of the same class does not seem to be a good design.