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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to