Common Script Patterns
Parse + validate + transform
let normalize maybeText =
match maybeText with
| Some text -> text |> String.toLower
| None -> ""
Map lookup with fallback
let getOrDefault key values fallback =
values
|> Map.tryGet key
|> Option.defaultValue fallback
Branch on rich outcomes
type Outcome =
| Accepted of string
| Rejected of string
Model meaningful states with unions and match over them.