My question is inspired by this one: link
Here is a code:
type A =
| X of int * int
| Y of string
let f (A.X(a, b)) = a + b
It works, but with a warning:
Makes sense; I have no match for Y.
But if I add a line
let f (A.Y(s)) = 10
Then I get an error:
Is there a nice way to fix it and still use pattern matching in function parameters? If not, then why did they create such strange syntax, which always leads to a warning?