[Haskell-cafe] Why does Haskell not infer most general type?

Edward Z. Yang ezyang at MIT.EDU
Tue Apr 6 16:50:24 EDT 2010


Excerpts from Brandon S. Allbery KF8NH's message of Tue Apr 06 16:46:28 -0400 2010:
> On Apr 6, 2010, at 15:56 , Job Vranish wrote:
> > Is haskell supposed to always infer the most general type (barring  
> > extensions)?
> Look up the monomorphism restriction.

Hey Brandon,

I tested the code with -XNoMonomorphismRestriction and it still inferred
the specific type, so perhaps this is either a GHC bug or something
different?  wnoise also points out that both functions take arguments,
so the monomorphism restriction doesn't apply.

See: http://www.reddit.com/r/haskell/comments/bn9to/type_checker_trivia_what_are_the_types_of_f_and_y/

Cheers,
Edward


More information about the Haskell-Cafe mailing list