On 2009 Mar 24, at 0:41, Zachary Turner wrote:
typeclass lookups will constantly have to be done at runtime if something is too generic.  Perhaps the fact that these other languages don't support typeclasses and hence don't have the same performance penalty is part of the reason why it's ok (or at the very least, not as bad) to do this in these languages as it is in Haskell?

That's my understanding, F++ types don't require any runtime lookups so inference can't surprise you.  Note that this is also applicable to the other problem:  since F++ doesn't have typeclasses, type errors are less likely to be caught in confusing places, and when they are the type error is much simpler; Haskell will happily infer unexpected typeclasses if it moves inference along, then include the typeclass in the error message when it finally stalls out.  Most commonly something like "Num (a -> b)" because you had too few/too many arguments somewhere, which points to another reason that type inference in Haskell can do unexpected things:  F++ has parenthesized function arguments, so it will catch too few/too many arguments directly, but Haskell's uncurried function call notation almost guarantees strange errors in those cases even if you have everything explicitly typed.

Prelude> :t fromInteger 4 6 :: Double

<interactive>:1:0:
    No instance for (Num (t -> Double))
      arising from a use of `fromInteger' at <interactive>:1:0-14
    Possible fix: add an instance declaration for (Num (t -> Double))
    In the expression: fromInteger 4 6 :: Double

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH