Ian Grant's Weather Report
Hindley-Milner Type Inference Tutorial https://prooftoys.org/ian-grant/hm/
It wasn't unification I had trouble with, it was type-scheme substitution (tssubs) and this function has a bug/feature which is that it doesn't work if there are free type variables in the assumptions. It's a feature because under that assumption it's actually a lot faster. The assumption rules out imperative types, I think, which are when there are free type variables in top-level expressions. It was that difficulty of specifying and correctly programming capture-avoiding substitution which motivated my attempt to generalise this problem (and the sution) with some notion of Natural Transformations. See Ian Grant's Weather Report agosto 01, 2022. In that code you should be able to see that the same algorithm is being apied to types and to values. Getting that idea to work using Standard ML recursive datatypes was hard, because I had to figure out how to apply the same Standard ML functors to two essentially different recursive datatypes. Hence my interest in these type equations in System-F: I don't have a photo of that page, but it's somewhere near this page:
See The Jaguar Circuit.
The Definition of Standard ML (Revised 1997)
This is the MIT 6.001 SICP Lecture 5A I was watching last night. I only got this far:
For more of this sort of stuff, see John C. Reynolds Definitional interpreters for higher-order programming languages and for an example in Standard ML see https://github.com/IanANGrant/red-october/blob/e454a6401a7223a45d617a3ea29cb083cb8ce0f2/src/dynlibs/ffi/DefInt.sml
Comments
Post a Comment