[Haskell-cafe] Haskell's type inference considered harmful [Re: [Haskell] A riddle...]
maydwell at gmail.com
Tue Jul 17 10:23:24 CEST 2012
You will be warned about the top-level definitions not including a
type-signature if you use the -Wall flag. This isn't really a complete
solution to your gripes, but it does address the change in behaviour
that you saw when adding/removing the commented code, and would draw
your attention to the logical error of trying to squeeze numbers that
were too large into a Word16.
I've been caught by unwarned truncation of numeric literals before
too, so it would be great if there were warnings for this.
On Tue, Jul 17, 2012 at 3:40 PM, Christopher Done <chrisdone at gmail.com> wrote:
> On 17 July 2012 09:27, Andreas Abel <andreas.abel at ifi.lmu.de> wrote:
>> 1. Haskell's type inference is NON-COMPOSITIONAL!
>> In the riddle below, I am defining two things f ("rgbliste") and g ("farbliste"). Even though they are not strongly connected, but g comes after f in the definition order, the code of g influences the type of f. THAT'S WRONG! :-(
> Bindings at the same level in Haskell are mutually recursive. Order of
> declaration does not matter. These two terms are unified by the type
> system. So I'm not sure what you expect to happen here.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe