Safe Haskell | None |
---|---|
Language | Haskell98 |
Descriptive.JSON
Contents
Description
A JSON API which describes itself.
- parse :: Monad m => d -> (a -> StateT s m (Maybe b)) -> Consumer s d m a -> Consumer s d m b
- object :: Monad m => Text -> Consumer Object (Doc d) m a -> Consumer Value (Doc d) m a
- key :: Monad m => Text -> Consumer Value (Doc d) m a -> Consumer Object (Doc d) m a
- keyMaybe :: Monad m => Text -> Consumer Value (Doc d) m a -> Consumer Object (Doc d) m (Maybe a)
- array :: Monad m => Text -> Consumer Value (Doc d) m a -> Consumer Value (Doc d) m (Vector a)
- string :: Monad m => Text -> Consumer Value (Doc d) m Text
- integer :: Monad m => Text -> Consumer Value (Doc d) m Integer
- double :: Monad m => Text -> Consumer Value (Doc d) m Double
- bool :: Monad m => Text -> Consumer Value (Doc d) m Bool
- null :: Monad m => Text -> Consumer Value (Doc d) m ()
- label :: Monad m => d -> Consumer s (Doc d) m a -> Consumer s (Doc d) m a
- data Doc a
Consumers
Arguments
:: Monad m | |
=> d | Description of what it expects. |
-> (a -> StateT s m (Maybe b)) | Attempt to parse the value. |
-> Consumer s d m a | Consumer to add validation to. |
-> Consumer s d m b | A new validating consumer. |
Parse from a consumer.
Arguments
:: Monad m | |
=> Text | Description of what the object is. |
-> Consumer Object (Doc d) m a | An object consumer. |
-> Consumer Value (Doc d) m a |
Consume an object.
Arguments
:: Monad m | |
=> Text | The key to lookup. |
-> Consumer Value (Doc d) m a | A value consumer of the object at the key. |
-> Consumer Object (Doc d) m a |
Consume from object at the given key.
Arguments
:: Monad m | |
=> Text | The key to lookup. |
-> Consumer Value (Doc d) m a | A value consumer of the object at the key. |
-> Consumer Object (Doc d) m (Maybe a) |
Optionally consume from object at the given key, only if it exists.
Arguments
:: Monad m | |
=> Text | Description of this array. |
-> Consumer Value (Doc d) m a | Consumer for each element in the array. |
-> Consumer Value (Doc d) m (Vector a) |
Consume an array.
Consume a string.
Arguments
:: Monad m | |
=> Text | Description of what the integer is for. |
-> Consumer Value (Doc d) m Integer |
Consume an integer.
Consume an double.
Parse a boolean.
Expect null.
Annotations
Arguments
:: Monad m | |
=> d | Some label. |
-> Consumer s (Doc d) m a | A value consumer. |
-> Consumer s (Doc d) m a |
Wrap a consumer with a label e.g. a type tag.