Module Mbrowse.Tie_breakerSource

Some nodes in the typedtree may share the same, non-ghost, location, while being different. One example of this is let-punning:

let+ x in

Both x as an expression and as a pattern share the exact same location.

This module is about tie-breaking those cases to select the node that we want.

Sourcetype tie_break =
  1. | Prefer_first
  2. | Prefer_second
Sourcetype t = node -> node -> tie_break option

If f : t, then f node1 node2 answers:

  • Some Prefer_first to select node1
  • Some Prefer_second to select node2
  • None to let the default disambiguation mechanism break the tie.
Sourceval prefer_expression : t

Tie-break by preferring expression over other nodes