Adding row polymorphism to Damas-Hindley-Milner

Introduction to HM Damas-Hindley-Milner (HM) type system for Standard ML and ML-family languages. River and the author previously discussed this topic. In this post, row polymorphism is added to scrapscript’s implementation of Algorithm J. Records in Scrapscript are dynamic, allowing any number of fields with any names and values. Pattern matching looks for specific fields in records, ignoring the rest. Unification of rows is straightforward, making types equal permanently. Let polymorphism allows functions to be generic over a single field, expanding the type over time. Row polymorphism is achieved through let polymorphism and unification of rows. Additional papers and resources on row polymorphism are recommended for further study.

https://bernsteinbear.com/blog/row-poly/

To top