
1 Jun
2008
1 Jun
'08
10:34 a.m.
On Sun, Jun 01, 2008 at 05:39:49PM +0400, Serge D. Mechveliani wrote:
This is why res and 1*res are not equivalent in Haskell-98 for res :: Num a => a.
Am I missing something?
The library functions assume that class instances obey some unwritten laws; it's all a bit vague, but if your instances don't obey them then you might find that things go wrong when using library functions. For example, if your (*) isn't associative then (^) is going to give odd results, and if the type of the second argument to (^) doesn't do arithmetic in the normal way then very strange things could happen. Anyway, I've just tweaked the (^) definition again, so your code should work in 6.8.3. Thanks Ian