[Haskell-cafe] function arithmetic?
Richard A. O'Keefe
ok at cs.otago.ac.nz
Mon Sep 2 02:03:01 CEST 2013
On 1/09/2013, at 7:06 PM, Christopher Howard wrote:
> It seemed to be suggesting that a Num instance for functions would imply the need for constant number functions, which leads to difficulties. But I don't see why one would have to take it that far.
You *cannot* make a type an instance of Num without saying how to
map integer literals to that type. If you want (f+g)x = fx + gx
then having 2x = 2 makes perfect sense, because then (f+2)x = fx + 2
just as an APL or S programmer would expect.
The fact that 2(x+y) will then evaluate to 2 without evaluating x or y
is unfortunate, but inevitable. I'm sure I could live with it.
More information about the Haskell-Cafe