Created
December 5, 2015 18:13
-
-
Save caindy/24e15d24621d31dec3a9 to your computer and use it in GitHub Desktop.
Using the special (?) F# operator to streamline the Fleece monadic syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
let shareMsgParser = fun j -> jsonParse { | |
let! shareWith = j?users | |
return Share shareWith } | |
*) | |
let inline (?) (j : JsonValue) (k : string) = | |
match j with | |
| JObject props -> jget props k | |
| _ -> Failure <| sprintf "%s not found in %A" k j |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment