Bucharest FP

A functional programming group for those living and working in Bucharest

We gather monthly, watch someone talk about something they're passionate about and then continue the discussion in a pub

#009: Type Inference: How Does it Work?

This meetup took place at the Eloquentix office, Wednesday, 31 March 2015 at 19:00. Find out when our next meetup is.

Type Inference: How Does it Work?

Ionuț G. Stan


Ionuț is a software developer at Eloquentix, where he works on backend services using Scala. His current interests revolve around functional programming techniques, programming languages and compilers.


Regardless of whether you love or hate statically typed languages, you probably have some respect for those which at least allow the programmer to write as few type annotations as possible. It's one of the reasons people are initially attracted to Scala, Haskell or an ML dialect, such as Standard ML, OCaml or F#. But how does that work? How is it possible to ensure type safety while writing few or, indeed, no type annotations at all?

This presentation aims to answer that question. We'll reconstruct the classic Damas-Hindley-Milner algorithm from the ground up for a small subset of ML. Scala will be used as an implementation language.

In addition to showing how type inference works, we'll also see its limits — what language features make type inference hard or even impossible.