Get the latest tech news

A reckless introduction to Hindley-Milner type inference (2019)


I've been editing this post on and off for almost a year. I'm not really happy with it, but I suspect I never will be.) Several months ago I gave a talk at work about Hindley-Milner type inference.

Custom operators (at least as implemented in Haskell and Elm) are equivalent to named functions, and don't gain or cost much in terms of legibility and expressivity. But they mean that a function call might not look like one, or vice-versa; expressions might get evaluated many times, or not at all; and the code might perform differently depending on the phase of the moon when it was compiled. On one level, I think that's a fairly minor imposition on language design, something you get "for free" by deciding that none of the built-in functions you provide will ever throw a runtime error.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Hindley-Milner

Hindley-Milner