module Null
open System.Runtime.CompilerServices
[<Extension>]
type public NullInterop =
static member Option<'nullable when 'nullable:null> (x:'nullable) =
match x with
| null -> None
| _ -> Some x
let map f (x:'T) : 'U option = x.Option() |> Option.map f