Also you might want abbreviation patterns. If your `value` type included all `color` values, like this:

type value = [color | `Missing]

then, you could write:

let state_of_value v = match v with
  | #color as c -> Color (color_index c)
  | `Missing -> Missing


On Thu, Feb 9, 2017 at 5:03 AM, Martin DeMello <martindemello@gmail.com> wrote:
On Thu, Feb 9, 2017 at 1:57 AM, Jeremy Yallop <yallop@gmail.com> wrote:
>
> let state_of_value v = match v with
>   | `Red  | `Blue  | `Green -> ?????
>   | `Missing -> Missing

  let state_of_value v = match v with
    | (`Red  | `Blue  | `Green) as c -> Color (color_index c)
    | `Missing -> Missing

perfect, thanks!

martin