No higher-rank polymorphism
Gap
Inference is Hindley-Milner, which is rank-1: a quantifier appears only at the outermost level of a type. Two consequences follow, and the Language Spec states the second:
- A function parameter is a monotype. An unannotated
finfun apply_both(f, x: i64, y: boolean)cannot be applied to both ani64and aboolean; the second use is rejected (T0001). - A generic function may not be referenced where the receiving position is
itself still generic in the callee (rank-2), nor where nothing pins down a
concrete instantiation; both are
T0003.
Impact
A Metel programmer cannot write a function that takes a polymorphic function argument and uses it at more than one type. Each use needs its own instantiation, or the argument must be a concrete function type.
Affects
Resolution
None recorded: no RFC or issue plans higher-rank polymorphism. RFC-0138 (implemented) defines the current boundary.