Constructors with several arguments

OCaml’s revised syntax addressed this point. In the revised syntax, the two declarations are:

type a = [ A of int and int ]
type b = [ B of (int * int) ]

and values have to be constructed differently:

value a = A 3 4
value b = B (3, 4)

Polymorphic variants, incidentally, are implemented as you say - they are always a tuple. There is a performance benefit to the flat representation.

1 Like