While ago, I wrote a 8-liner Curry program of STLC type inference. (6 lines excluding datatype declearation)
There is a 7 liner Prolog for Hindley–Milner!
(I didn’t write this but stumbled across while web searching)
This 7-liner is not pure Prolog ‘cuase it uses
copy_term/2 to implement instantiation of polymorphic types.
I wonder how much this would scale up. I think it should work up to type constructor polymorphism for regular ADTs in functional languages, and may also be able to add top-level rank-1 kind polymorphism on top of that. But it might get messy once you start to throw in non-regular datatypes and even worse when GADTs come along.