Skip to content

Pattern Inference

Alistair O'Brien requested to merge ajob410/pattern-inference into dev

type:changed

This MR improves the type inference of patterns by adding "pattern inference".

Previously patterns were only checked, thus any complex pattern (e.g. a tuple, record, variant, etc) required an annotation. Pattern inference (like inference for expressions) relaxes this restriction allowing us to infer the type of a pattern from its structure.

For example, the following now type checks:

let add (x, y) = x + y

Whereas previously, we would require:

let add ((x, y) : int * int) = x + y

Future work:

Changelog details:

Add pattern inference

Edited by Alistair O'Brien

Merge request reports