
10 Apr
2013
10 Apr
'13
1:34 p.m.
On Wed, Apr 10, 2013 at 03:38:35PM +0100, Barak A. Pearlmutter wrote:
In fiddling around with some numeric code in Haskell, I noticed some issues. Basically, you get warnings if you write
energy mass = mass * c^2
but not if you write
energy mass = mass * c * c
Numeric typeclasses are syntactically convenient, but are rather too implicit for my taste. I prefer using monomorphic versions once the code becomes serious. For example, import Prelude hiding ((^)) import qualified Prelude (^) :: Num a => a -> Integer -> a (^) = (Prelude.^) energy mass = mass * c^2 This does not solve your other issues though. Tom