[Haskell-cafe] Numerics and Warnings

Roman Cheplyaka roma at ro-che.info
Wed Apr 10 20:25:10 CEST 2013


* Barak A. Pearlmutter <barak at cs.nuim.ie> [2013-04-10 15:38:35+0100]
> 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
> 
> which seems a bit perverse.
> Some more examples are below.
> 
> I understand the inference issues that cause this, but common innocuous
> cases could---and I would argue, should---be addressed in ad-hoc ways.

Hi Barak,

In a sense, defaulting in Haskell *is* a mechanism to address common
innocuous cases in an ad-hoc way (although it still has a relatively
simple and easy to understand semantics).

If you'd like something even more ad-hoc, take a look at Ruby or
JavaScript: http://www.youtube.com/watch?v=kXEgk1Hdze0

Roman



More information about the Haskell-Cafe mailing list