Full static type inference of set theoretic types

I think a good chunk of the constraints applied here is that the typesystem is meant to be an optional piece on top of how people write elixir today – at best providing benefits to users without them needing to change anything/much to the code.

Elixir as it’s written today extensively uses multiple function heads to branch off functions based on input parameters. At least to me inline type annotation never made much sense in the context of multiple function heads. As an example there are commonly functions where you have converging codepaths of many possible inputs to a single output (a | b | c -> x). You’d duplicate the result type if you put it on the function head.

I prefer the duplication of external type annotations for inputs – which are commonly in one place and therefore easy to find/read – to duplication of return values, which are scattered over potentially many lines of code with the function heads of the actual implementation of the function.

2 Likes