When a contact method can be one of a fixed set of cases, a match should handle every case. With an F# discriminated union, the compiler knows that set and warns when a pattern is missing. A string field cannot offer the same check: another string could always be passed in. section 8.3.3
Handle each case explicitly
For `type Instrument = Guitar | Drums | Bass`, a `play` function can match `Guitar`, `Drums`, and `Bass` separately. If a fourth case is added, an incomplete match produces a warning until that case has a handler. Replacing `Bass` with `_` saves a line but also lets future cases fall into that branch without a warning. section 14.1.1
The check reaches into nested unions. If `Sms` contains a telephone number that is either `Local` or `International`, matching only `Sms (Local number)` leaves the international case uncovered; the warning identifies it. section 8.3.4
Listing 8.10 Modeling a nested (recursive) relationship with unions
type TelephoneNumber = #1
| Local of number:string
| International of countryCode:string * number:string
type ContactMethod =
| // ... other cases omitted
| Sms of TelephoneNumber #2
let smsContact = Sms (Local "123-4567") #3
The `Sms` case contains another union, so its local and international forms can be matched separately. section 8.3.4
For a loan decision, replacing integer and Boolean inputs with bounded unions makes the match and its function signature more readable. Prefer explicit cases when a new case should demand a decision; use a wildcard only when grouping future cases is intentional. Completeness checking does not verify that each branch returns the right answer, so tests can still help with branch behavior. section 8.3.4 section 14.1.1
