[Haskell-cafe] Type inference for lambda function

Viktor Dukhovni ietf-dane at dukhovni.org
Mon Nov 1 05:10:14 UTC 2021

On Mon, Nov 01, 2021 at 12:54:47AM -0400, David Feuer wrote:

> It would silently change behavior of some programs, yes. It could also make
> them slower under some circumstances. But anyone relying on the
> monomorphism restriction to choose types for their program should change
> their ways regardless. Top level type signatures aren't that hard to write.

It isn't just, or even primarily top level signatures.  It is more often
let bindings that will lack a signature, and frankly I'd rather have
the restriction in place.

When your type fails to generalise and code does not compile, the
solution is not hard to find.  When let-bound expressions cease
to be CAFs, and start being evaluated repeatedly, rather than
just once, that's substantially harder to find and diagnose.


More information about the Haskell-Cafe mailing list