Let this types =
type intC = int;;
type boolC = bool;
type stringC = string;;
type component = A of intC | B of boolC | C of stringC;;
If I want to apply a function on the type a of a component A, do I need systematically to deconstruct the component ?
for exemple do i have to do :
let add comp =
match comp with
| A i -> Some (i + 2) (*only A interests me, I return i + 2*)
| _ -> None (*otherwise I return nothing*)
and then for any function on a component A ? Is there any mean to avoid thy redundancy ?