Dimension inference under polymorphic recursion

Mikael Rittri
1995 Proceedings of the seventh international conference on Functional programming languages and computer architecture - FPCA '95  
Numeric types can be given polymorphic dimension parameters, in order to avoid dimension errors and unit errors. The most general dimensions can be inferred automatically. It has been observed that polymorphic recursion is more important for the dimensions than for the proper types. We show that, under polymorphic recursion, type inference amounts to syntactic semi-unification of proper types, followed by equational semi-unification of dimensions. Syntactic semi-unification is unfortunately
more » ... cidable, although there are procedures that work well in practice, and proper types given by the programmer can be checked. However, the dimensions form a vector space (provided that their exponents are rational numbers). We give a polynomial-time algorithm that decides if a semi-unification problem in a vector space can be solved and, if so, returns a most general semi-unifier.
doi:10.1145/224164.224197 dblp:conf/fpca/Rittri95 fatcat:h4ihcnclifdpbhcs2arypklafe