Is is possible to pattern match on the underlying shape of a discriminated union?
问题 Does F# support pattern matching of a discriminated union member instance by criteria other than the Identifier pattern? For example, imagine that I want to match on the underlying shape of the data and I want to consider anything with an int * int shape, regardless of how the DU classifies the value. Is Here's how I'd do it now: type ExampleDU = | BinaryCase1 of x:int * y:int | BinaryCase2 of x:int * y:int | UnaryCase1 of x:int let underlyingValue = (1,2) let asCase1 = BinaryCase1