Compare commits

..

16 commits

2 changed files with 29 additions and 0 deletions

View file

@ -238,6 +238,7 @@ parseTheseChars cs = do
Attempt to parse an exact string
```idris
export
exactString : String -> Parser String
exactString str with (asList str)
exactString "" | [] = pure ""

View file

@ -209,3 +209,31 @@ string = do
_ <- parseExactChar '"'
pure $ VString contents
```
```idris
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
```