Open haf opened 7 years ago
let tryDeserializeWith (fromJson : Json<'a>) : Json -> Choice<'a, string> = fun json -> match fromJson json with | JsonResult.Value x, _ -> Choice.create x | JsonResult.Error err, _ -> Choice.createSnd err let tryDeserializeWithP (_, fromJson : Json<'a>) : Json -> Choice<'a, string> = tryDeserializeWith fromJson let deserializeWith (fromJson : Json<'a>) : Json -> 'a = fun json -> match tryDeserializeWith fromJson json with | Choice1Of2 x -> x | Choice2Of2 err -> failwith err let deserializeWithP (_, fromJson : Json<'a>) : Json -> 'a = deserializeWith fromJson
This would be really handy since there is already serializeWith.
serializeWith