A variant type lets you represent different cases in one type.
type myResult<'a> = | MyVariant('a) | Error(string) let response = MyVariant(42) let message = switch response { | MyVariant(value) => "Success: " ++ Int.toString(value) | Error(err) => "Error: " ++ err }
Variant
Pattern Matching