This implementation is based on Algorithm W step by step by Martin Grabüller with the addition of row polymorphism. If you compare this implementation with HMPure you should be able to see the row polymorphism additions.
All code is in a self contained project: HMPure-Rowpolymorphism
Algorithm W step by step, Martin Grabmuller Extensible records with scoped labels, Daan Leijen