diff --git a/src/Parser/JSON.md b/src/Parser/JSON.md index 2634d83..f09c8dd 100644 --- a/src/Parser/JSON.md +++ b/src/Parser/JSON.md @@ -68,6 +68,7 @@ Show (JSONValue t) where show (VBool True) = "true" show VNull = "null" +-- TODO: Deal with keys potentially having different orders in different objects Eq (JSONValue t) where (VObject xs) == (VObject ys) = assert_total $ xs $== ys @@ -263,25 +264,20 @@ quickSmoke = do printLn err pure False putStrLn "Input: \{input}\nOutput: \{show type} -> \{show parsed}" - case parsed of - VObject {types} xs => do - putStrLn "Output types: \{show types}" - case decEq types [TString, TNumber, TBool, TBool, TNull, TArray] of - No contra => pure False - Yes Refl => case xs of - [ ("string", str) - , ("number", num) - , ("true", bool_t) - , ("false", bool_f) - , ("null", nul) - , ("array", arr) - ] => pure $ - str == VString "string" - && num == VNumber 5.0 - && bool_t == VBool True - && bool_f == VBool False - && nul == VNull - && arr == VArray [VNumber 1.0, VNumber 2.0, VNumber 3.0] - _ => pure False + let reference_object = + VObject [ + ("string", VString "string") + , ("number", VNumber 5.0) + , ("true", VBool True) + , ("false", VBool False) + , ("null", VNull) + , ("array", VArray [ + VNumber 1.0 + , VNumber 2.0 + , VNumber 3.0 + ]) + ] + case type of + TObject => pure $ parsed == reference_object _ => pure False ```