Skip to content

Instantly share code, notes, and snippets.

@artur-s
Last active November 13, 2016 04:03
Show Gist options
  • Save artur-s/4e14f557e3d3018bc338f7b37d4e637b to your computer and use it in GitHub Desktop.
Save artur-s/4e14f557e3d3018bc338f7b37d4e637b to your computer and use it in GitHub Desktop.
Operators for matching option and nullable
module Option =
let (|??) = defaultArg
let (|?) nullable d = if isNull nullable then d else nullable
// usage
open Option
[] |> List.tryHead |?? 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment