As per the title, is there any way to constrain an F# generic function to a union type? So far I am using:
let toDomain<'T> external: 'T option =
assert FSharpType.IsUnion(typeof<'T>)
...
Which fails at runtime with a System.ArgumentException if I attempt to use a non-union, but I would prefer the check earlier.