Every F# programmer is likely familiar with pattern matching using the match keyword, as illustrated below: match x with | Some 0 -> "Zero" | Some n when n > 0 -> "Positive" | Some n when n < 0 -> "Negative" | None -> "Unknown" However, a less well-...

Markdown supported · ⌘↵ to post
David Neale
type MultipleOptions = | Thingys of string * int | Wotsits of int
let multiInputMultiply (MultipleOptions.Thingys (_, v) | MultipleOptions.Wotsits v) = v * 42
let r = multiInputMultiply (Thingys ("hey!", 88)) let s = multiInputMultiply (Wotsits 44)