json: Bool and null

This commit is contained in:
Nathan McCarty 2025-01-25 05:09:24 -05:00
parent e46e1663b9
commit 2111e20f33

View file

@ -215,3 +215,25 @@ number = do
d <- double
pure $ VNumber d
```
```idris
bool = do
oneOfE
(throwParseError "Expected Bool")
(the (List _) [true, false])
where
true : Parser (JSONValue TBool)
true = do
_ <- exactString "true"
pure $ VBool True
false : Parser (JSONValue TBool)
false = do
_ <- exactString "false"
pure $ VBool False
```
```idris
null = do
_ <- exactString "null"
pure VNull
```