Hindley--Milner in 7 lines of hacky Prolog
While ago, I wrote a 8-liner Curry program of STLC type inference. (6 lines excluding datatype declearation)
http://www-ps.informatik.uni-kiel.de/smap/smap.cgi?browser/31 http://kyagrd.tumblr.com/post/103510371489/stlc-type-inference-in-8-lines-of-curry
There is a 7 liner Prolog for Hindley--Milner! (I didn't write this but stumbled across while web searching)
http://lpaste.net/65035
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.














