From f7b684dbdae9229a69258a7e575395af120d2654 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 11 Oct 2019 15:06:18 -0400 Subject: JSON records with optional fields --- lib/ur/json.urs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/ur/json.urs') diff --git a/lib/ur/json.urs b/lib/ur/json.urs index b4bd6350..56f5a897 100644 --- a/lib/ur/json.urs +++ b/lib/ur/json.urs @@ -17,6 +17,10 @@ val json_option : a ::: Type -> json a -> json (option a) val json_list : a ::: Type -> json a -> json (list a) val json_record : ts ::: {Type} -> folder ts -> $(map json ts) -> $(map (fn _ => string) ts) -> json $ts +val json_record_withOptional : ts ::: {Type} -> ots ::: {Type} -> [ts ~ ots] + => folder ts -> $(map json ts) -> $(map (fn _ => string) ts) + -> folder ots -> $(map json ots) -> $(map (fn _ => string) ots) + -> json $(ts ++ map option ots) val json_variant : ts ::: {Type} -> folder ts -> $(map json ts) -> $(map (fn _ => string) ts) -> json (variant ts) val json_unit : json unit -- cgit v1.2.3