This is an implementation of type inference for safe, polymorphic and extensible records. This code is based on the implementation here. Essentially this implementation is the same as HMMutable with row polymorphism added. You can see the extension by examining the additional union case fields in the expr type that describe all the different operations that can be applied: RecordSelect, RecordExtend, RecordRestrict and RecordEmpty. And again in ty: TRecord , TRowEmpty and TRowExtend byt looking at the usages of these types you can see which parts of the algorithm change.
All code is in a self contained project: HMMutable-RowPolymorphism
Extension of ML Type System with a Sorted Equational Theory on Types, Didier Rémy Extensible records with scoped labels, Daan Leijen