Nested union types in F#

f#, types

Solution

No, you'll have to separate the types(as in kvb's post). I have heard of plans to add polymorphic variance (as in ocaml) to F#, which would allow you to do something similar.

In ocaml,

type mainType =
    | A of [ `AA of int | `AB of float ]
    | B of int   

Problem

Is there any way to crate nested union types in F#? Something like this ``` type MainType = | A of | AA of int | AB of float | B of int ```

Original source