json: Bool and null
This commit is contained in:
parent
e46e1663b9
commit
2111e20f33
1 changed files with 22 additions and 0 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue