この型を =
type intC = int;;
type boolC = bool;
type stringC = string;;
type component = A of intC | B of boolC | C of stringC;;
コンポーネント A のタイプ a に関数を適用したい場合、コンポーネントを体系的に分解する必要がありますか?
たとえば、私はしなければなりませんか:
let add comp =
match comp with
| A i -> Some (i + 2) (*only A interests me, I return i + 2*)
| _ -> None (*otherwise I return nothing*)
次に、コンポーネント A の任意の機能について ? あなたの冗長性を避ける手段はありますか?