I’ve been studying THIH by Mark P Jones recently (Typing Haskell in Haskell); it’s a good, executable introduction* to the mechanics of type inference in our favorite language.
There is a copy of the original repository on Hackage (uploaded by Gwern in 2008 , thih: Typing Haskell In Haskell ), but until today it did not have a backup maintainer.
I think it would be valuable to save this project from bitrot and perhaps feature it in a more central place in our ecosystem. It certainly deserves better Haddock documentation and more readable tests.
I think it would be great to have a simple implementation of the type system to do research on. I wanted to see what it would take to implement MLF and also found THIH, but I bounced off.
I also copied the thih source and iterated on it to produce Duet GitHub - chrisdone/duet: A tiny language, a subset of Haskell aimed at aiding teachers teach Haskell which is a Haskell subset. The thing missing from THIH which I had to figure out was converting type class contexts into actual dictionaries. That’s a whole extra stage. Plus kind checking for data declarations and type checking of instances and stuff like that.
(I’ve since done a complete ground up implementation of a compiler (https://inflex.io/) with type classes based on this experience but the architecture is quite different (Inflex - Google Slides), but it’s not open source yet.)