Notes: 21 September 2026

Mon 21 September 2026

Filed under Posts

Tags weeknotes

Last week was largely spent doing some plumbing to get the unification working. Thankfully it's pretty much as before, except that we need to keep track of local definitions as well as everything else, just so that we have the whole context if we encounter a unification problem that's stuck awaiting further information.

Aside: without going into all of the details, and being informal about it, unification is the crucial part of type checking that works out whether it is possible for two types/values to be the same, and, if so, how to make them the same. "Make them the same" essentially means filling in any metavariables (in practice in Idris that's implicit arguments) encountered on the way. In a dependently typed language, you occasionally encounter a unification problem that is not yet solvable, but might be once further information turns up (like, the result of a another unification constraint) which allows evaluation to continue. So this means unification can have one of three results:

  1. Yes, and here's the metavariable solutions I found
  2. Definitely no, and here's why not
  3. Maybe, ask me again later, and here's the unsolved constraints

So that means we need to do a bit of bookkeeping so that when it's time to retry, we have all the information we need.

Anyway, that's all done now. Local definitions don't make it any more complicated because we're working with already evaluated terms. It's just that we might need to evaluate some more once more information arrives.

So that means that I can finally move on to the interest bit, hooray! Today I've started on the surface language. Keeping it small for now, only dealing with lambda, pi, and function applications with implicit arguments so that I can get the basic structure of the elaborator working. There's so much I want to change about elaboration since Idris 2 that I've decided it's best just to start from scratch. That's not quite as bad as it sounds because many of the fiddly details like dealing with unbound implicits, pattern variables, shuffling the context around and case tree compilation will be similar enough that I can borrow things from Idris 2. But the overall structure had got messy (to be honest, it began messy) so it deserves a bit of a rethink.

Anyway. More ramblings on this to come.


Comments


Edwin Brady © Edwin Brady Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More