Writing type inference algorithms in OCaml

Thanks you for the reference - ahh, I should definitely read the parts about the implementation of type inference rather than just winging it - I guess once I had the general picture of how the constraint based inference worked, I skipped straight to implementing it without reading about union-find/efficient ways of solving constraints - my implementation used a mix of equivalence classes for cannonicalising type variables, and a substitution based unification loop.

Ah, thanks, yes, inferno looks promising, and having looked at the examples, seems fairly straightforward to use.

Looking through the Elpi repository, there seem to be enough examples there that I feel reasonably confident that I could work out how to embed a type system into the language - the problem I’m having is that it’s rather challenging to access it programmatically - the compiler/parser part is somewhat straightforward, but I’ve been stumped on which API endpoints I would use to convert my syntax tree (parsed elsewhere) into a query to submit to Elpi.