私は次の差別された組合を持っています:
type ActCard = Cellar of card list
| Chapel of (card option * card option* card option* card option)
| Smithy | Spy of (card -> bool * card -> bool)
に を追加するまで、構造的に同等でしcard -> bool
たSpy
。この質問は、レコードのカスタム等価を行う方法に役立ちます。ただし、この状況でどのように実装するのが最善かはわかりません。で各ケースを列挙する必要はありませんActCard
。
override x.Equals(yobj) =
match x, yobj with
| Spy _, Spy _ -> true
| Cellar cards, Cellar cards2 -> cards = cards2
(* ... etc *)
ここでより良いアプローチは何ですか?