let withDefault default opt = match opt with | Some v -> v | None -> default let map f opt = match opt with | Some v -> Some (f v) | None -> None