type Address = { street : string; city : string option } type Author = { name : string; email : string; address : Address option } type Article = { title : string; content : string; author : Author option } let printCity (article : Article) = article.author |> Option.bind(fun author -> author.address) |> Option.bind(fun address -> address.city) |> Option.iter(fun city -> printfn "%s" city)
maybe { let! address = author.address let! city = address.city printfn %s city }