Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- parseResultsWith :: (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a) -> Value -> Parser (Vector a)
- parseResultsWithDecoder :: Decoder -> (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a) -> Value -> Parser (Vector a)
- newtype Decoder = Decoder (forall a. SomeDecoder a)
- data SomeDecoder a = SomeDecoder {
- decodeEach :: Parser a -> Parser b
- decodeFold :: Parser (Vector b) -> Parser (Vector a)
- strictDecoder :: Decoder
- lenientDecoder :: Decoder
- getField :: MonadFail m => Text -> Vector Text -> Vector Value -> m Value
- getTag :: MonadFail m => Text -> HashMap Text Value -> m Value
- parseJSON :: FromJSON a => Value -> Parser a
- parseUTCTime :: Precision ty -> Value -> Parser UTCTime
- parsePOSIXTime :: Precision ty -> Value -> Parser POSIXTime
- parseRFC3339 :: ParseTime time => Value -> Parser time
- parseResultsObject :: Value -> Parser (Vector Value)
- parseSeriesObject :: Value -> Parser (Vector Value)
- parseSeriesBody :: Value -> Parser (Maybe Text, HashMap Text Text, Vector Text, Array)
- parseErrorObject :: Value -> Parser String
Result parsers
:: (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a) | A parser that parses a measurement. A measurement consists of
|
-> Value | JSON response |
-> Parser (Vector a) |
Parse a JSON response with the strictDecoder
.
parseResultsWithDecoder Source #
:: Decoder | |
-> (Maybe Text -> HashMap Text Text -> Vector Text -> Array -> Parser a) | A parser that parses a measurement. A measurement consists of
|
-> Value | JSON response |
-> Parser (Vector a) |
Parse a JSON response with the specified decoder settings.
Decoder settings
A decoder to use when parsing a JSON response.
Use strictDecoder
if you want to fail the entire decoding process if
there's any failure. Use lenientDecoder
if you want the decoding process
to collect only successful results.
Decoder (forall a. SomeDecoder a) |
data SomeDecoder a Source #
represents how to decode a JSON response given a row
parser of type SomeDecoder
a
.Parser
a
SomeDecoder | |
|
strictDecoder :: Decoder Source #
A decoder that fails immediately if there's any parse failure.
strictDecoder
is defined as follows:
strictDecoder :: Decoder strictDecoder = Decoder $ SomeDecoder { decodeEach = id , decodeFold = id }
lenientDecoder :: Decoder Source #
A decoder that ignores parse failures and returns only successful results.
Getting fields and tags
Get a field value from a column name
Get a tag value from a tag name
Common JSON object parsers
parseUTCTime :: Precision ty -> Value -> Parser UTCTime Source #
Parse either a POSIX timestamp or RFC3339 formatted timestamp as UTCTime
.
parsePOSIXTime :: Precision ty -> Value -> Parser POSIXTime Source #
Parse either a POSIX timestamp or RFC3339 formatted timestamp as
POSIXTime
.