This code compiles just fine in F# as well as OCaml:
let testmatch k =
match k with
| jqk3jtl23jtlk123 -> true
I've tested in both FSI and utop. It always returns true.
The jqk3jtl23jtlk123 is totally random, and its type is inferred as 'a. Even if I constrain k with a datatype (e.g. let testmatch (k: int) =) it compiles (though obviously constraining testmatch's type to int -> bool instead of 'a -> bool.
Could someone please explain what's going on? Specifically:
- why does the compiler accept a totally random literal
jqk3jtl23jtlk123? - why do I not get an inexhaustive match warning?
- what is the match actually doing?