Skip to content

Instantly share code, notes, and snippets.

@CoditCompany
Created September 24, 2017 08:52
Show Gist options
  • Select an option

  • Save CoditCompany/e37950ca946568dfc83a24a65a1745fc to your computer and use it in GitHub Desktop.

Select an option

Save CoditCompany/e37950ca946568dfc83a24a65a1745fc to your computer and use it in GitHub Desktop.
let customer country name street city state postal =
{ Country = country
FullName = name
Street = street
State = state
City = city
PostalCode = postal }
let optApply fOpt xOpt =
match fOpt, xOpt with
| Some f, Some x -> f x |> Some
| _, _ -> None
let optCustomer country name street city state postal =
let (<!>) = Option.map
let (<*>) = optApply
customer <!> country <*> name <*> street <*> city <*> state <*> postal
let pcustomer = pipe6 country fullname street city state postal optCustomer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment