Mentions légales du service

Skip to content

[small refactoring] F variant simplification

This small refactoring changes the representation of variant constructors in the explicitly-typed F syntax. We move from

| Variant of type list * label * term

for example, Variant([int], Some, 3) for Some 3, to

| Variant of label * (type_constructor * type list) * term

for example Variant(Some, (option, [int]), 3).

Both are unambiguous / let us type-check without doing any inference (this is why the instances of the type parameters are needed), but the former representation still requires doing a lookup of the label in the type-declaration environment, which in turns assumes that label conflicts between different types are forbidden. With @omartino we have been working on type-directed label disambiguation, where several types may share label names (not in this MR). Then the second form is required.

Merge request reports