如果我有一个具有共享子项的联合类型(
有没有一种方法可以匹配子联合以删除重复项?类似于以下内容:
Apple
和MoreApples
都具有类型Apple
)...type Apples =
| GrannySmith
| Gala
type Fruit =
| Apple of Apples
| MoreApples of Apples
| Banana
let speakFruit = function
| Apple GrannySmith
| MoreApples GrannySmith -> "granny smith"
| Apple Gala
| MoreApples Gala -> "gala"
| Banana -> "banana"
有没有一种方法可以匹配子联合以删除重复项?类似于以下内容:
let speakFruit2 = function
| _ GrannySmith -> "granny smith"
| _ Gala -> "gala"
| Banana -> "banana"