I know that you can add methods and properties to discriminatory joins, but can you add an immutable field that must be set when the join instance is created, like the fields in a record?
I assume that I would like to combine the union type and the record type, for example:
type union = | OptionOne of int | OptionTwo of string { AFieldUsedForBothCases : string }
which is not a valid declaration.
I know that this can be solved by creating a record type:
type record = { AFieldUsedForBothCases : string TheDiscriminatedUnion : union }
but I would like to do something similar to the first example, if possible.
source share