* Aleksey Khudyakov <alexey.sklad...@gmail.com> [2013-04-10 23:20:15+0400] > On 10 April 2013 22:25, Roman Cheplyaka <r...@ro-che.info> wrote: > > * Barak A. Pearlmutter <ba...@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). > > > This IS rather annoying problem for numeric code. Raising value to positive > power is quite common operation yet ^ operator generally couldn't be used > because it leads to warning about type defaulting (rightfully) and one > wants to keep code warning free. Actually it's problem with warnings and > I don't think adding some ad-hoc rules for generating warning is necessarily > bad idea
You can disable the warning with -fno-warn-type-defaults. Roman _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe