You need to match the pattern by argument:
let f = function
| X(a, b) -> a + b
| Y(_) -> 10
When you define
let f (A.X(a, b)) = a + b
f A -> int, A.X -> int. , A.Y, .
f A -> int, , , . - , function match.
EDIT: , , , match :
let f a1 a2 =
match (a1, a2) with
| (X(a, b), X(a', b')) -> a + b
| (X(a, b), Y(s)) -> a + 10
| (Y(s), X(a, b)) -> 10
| (Y(s), Y(s')) -> 20