How does the compiler check for exhaustive pattern matching?

No, but you can use when guards and as binds to implement some of them, e.g., F# pattern (x,y) & (_,"hello") could be encoded in OCaml as

  • (x, "hello" as y) or as
  • (x,y) when y = "hello".

See also,

1 Like