F# tips weekly #2: Single case pattern match
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-...
jindraivanek.hashnode.dev2 min read
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)