Safe Haskell | None |
---|---|
Language | Haskell2010 |
Extensions to Aeson parsing of objects.
- (.:) :: FromJSON a => Object -> Text -> Parser a
- (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)
- data JSONWarning
- type WarningParser a = WriterT WarningParserMonoid Parser a
- data WithJSONWarnings a = WithJSONWarnings a [JSONWarning]
- withObjectWarnings :: String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a)
- jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a
- jsonSubWarningsT :: Traversable t => WarningParser (t (WithJSONWarnings a)) -> WarningParser (t a)
- jsonSubWarningsTT :: (Traversable t, Traversable u) => WarningParser (u (t (WithJSONWarnings a))) -> WarningParser (u (t a))
- logJSONWarnings :: (MonadReader env m, HasLogFunc env, HasCallStack, MonadIO m) => FilePath -> [JSONWarning] -> m ()
- noJSONWarnings :: a -> WithJSONWarnings a
- tellJSONField :: Text -> WarningParser ()
- unWarningParser :: WarningParser a -> Parser a
- (..:) :: FromJSON a => Object -> Text -> WarningParser a
- (..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a)
- (..!=) :: WarningParser (Maybe a) -> a -> WarningParser a
Extended failure messages
(.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a) Source #
Extends .:?
warning to include field name.
JSON Parser that emits warnings
data JSONWarning Source #
Warning output from WarningParser
.
type WarningParser a = WriterT WarningParserMonoid Parser a Source #
JSON parser that warns about unexpected fields in objects.
data WithJSONWarnings a Source #
withObjectWarnings :: String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a) Source #
WarningParser
version of withObject
.
jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a Source #
Handle warnings in a sub-object.
jsonSubWarningsT :: Traversable t => WarningParser (t (WithJSONWarnings a)) -> WarningParser (t a) Source #
Handle warnings in a Traversable
of sub-objects.
jsonSubWarningsTT :: (Traversable t, Traversable u) => WarningParser (u (t (WithJSONWarnings a))) -> WarningParser (u (t a)) Source #
Handle warnings in a Maybe Traversable
of sub-objects.
logJSONWarnings :: (MonadReader env m, HasLogFunc env, HasCallStack, MonadIO m) => FilePath -> [JSONWarning] -> m () Source #
Log JSON warnings.
noJSONWarnings :: a -> WithJSONWarnings a Source #
tellJSONField :: Text -> WarningParser () Source #
Tell warning parser about an expected field, so it doesn't warn about it.
unWarningParser :: WarningParser a -> Parser a Source #
Convert a WarningParser
to a Parser
.
(..:) :: FromJSON a => Object -> Text -> WarningParser a Source #
WarningParser
version of .:
.
(..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a) Source #
WarningParser
version of .:?
.
(..!=) :: WarningParser (Maybe a) -> a -> WarningParser a Source #
WarningParser
version of .!=
.