Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 412 Bytes

File metadata and controls

30 lines (18 loc) · 412 Bytes

Option.map

Namespace: FsToolkit.ErrorHandling

Apply a function to the value of an option if it is Some. If the option is None, return None.

Function Signature

('TInput-> 'TOutput) -> 'TInput option -> 'TOutput option

Examples

Example 1

Option.map (fun x -> x + 1) (Some 1)

// Some 2

Example 2

Option.map (fun x -> x + 1) None

// None