Prerequisite knowledge for building Elm's type-system

TL;DR: What knowledge would be sufficient to prototype Elm’s type-system if you were building it yourself today? There are plenty of resources for developing new programming languages, but not so many I’ve seen for developing type checkers and systems for new programming languages. In particular, I would love book or article recommendations, but any insight would be helpful.

Thank you! :smiling_face:


Long version

Hi there! I’m curious about developing domain-specific languages (DSLs) and absolutely love Elm for its

  • carefully selected subset of functional programming language features to make UI development more productive
  • slow evolution philosophy and not being in a rush to take over the world
  • exceptionally user-friendly error messages that help you iterate towards your next working UI prototype

I am curious about building simple DSLs (largely for customising ecommerce apps). I may even choose Elm as my target language for the output of my DSL.

Nice summary here: Damas-Hindley-Milner inference two ways | Max Bernstein

Elms algorithm looks like Algorithm J in that write up.

The only resource that I personally found helpful was The Essence of ML Type Inference. It’s great. That’s what everyone works from as far as I know. I do not know how to find the implementation that originally went with that chapter, but the author has put something similar together here.

You can also poke around the class notes of various universities’ classes on compilers. They sometimes work through a “good enough” implementation (usually one that is observably worse than O(n) in the length of the input programs, but easier to implement!)