Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Aeson.WarningParser
Synopsis
- type WarningParser a = WriterT WarningParserMonoid Parser a
- data JSONWarning
- = JSONUnrecognizedFields String [Text]
- | JSONGeneralWarning !Text
- 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 -> Parser a
- (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)
- (..:) :: FromJSON a => Object -> Text -> WarningParser a
- (...:) :: FromJSON a => Object -> [Text] -> WarningParser a
- (..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a)
- (...:?) :: FromJSON a => Object -> [Text] -> WarningParser (Maybe a)
- (..!=) :: WarningParser (Maybe a) -> a -> WarningParser a
Documentation
type WarningParser a = WriterT WarningParserMonoid Parser a Source #
A JSON parser that warns about unexpected fields in objects.
data JSONWarning Source #
Warning output from WarningParser
.
Constructors
JSONUnrecognizedFields String [Text] | |
JSONGeneralWarning !Text |
Instances
IsString JSONWarning Source # | |
Defined in Data.Aeson.WarningParser Methods fromString :: String -> JSONWarning | |
Show JSONWarning Source # | |
Defined in Data.Aeson.WarningParser Methods showsPrec :: Int -> JSONWarning -> ShowS show :: JSONWarning -> String showList :: [JSONWarning] -> ShowS | |
Eq JSONWarning Source # | |
Defined in Data.Aeson.WarningParser | |
Display JSONWarning Source # | |
Defined in Data.Aeson.WarningParser |
data WithJSONWarnings a Source #
Constructors
WithJSONWarnings a [JSONWarning] |
Instances
Functor WithJSONWarnings Source # | |
Defined in Data.Aeson.WarningParser Methods fmap :: (a -> b) -> WithJSONWarnings a -> WithJSONWarnings b (<$) :: a -> WithJSONWarnings b -> WithJSONWarnings a | |
FromJSON (WithJSONWarnings StylesUpdate) Source # | |
Defined in Data.Aeson.WarningParser Methods parseJSON :: Value -> Parser (WithJSONWarnings StylesUpdate) parseJSONList :: Value -> Parser [WithJSONWarnings StylesUpdate] | |
Monoid a => Monoid (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser Methods mempty :: WithJSONWarnings a mappend :: WithJSONWarnings a -> WithJSONWarnings a -> WithJSONWarnings a mconcat :: [WithJSONWarnings a] -> WithJSONWarnings a | |
Monoid a => Semigroup (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser Methods (<>) :: WithJSONWarnings a -> WithJSONWarnings a -> WithJSONWarnings a sconcat :: NonEmpty (WithJSONWarnings a) -> WithJSONWarnings a stimes :: Integral b => b -> WithJSONWarnings a -> WithJSONWarnings a | |
Generic (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser Associated Types type Rep (WithJSONWarnings a) :: Type -> Type Methods from :: WithJSONWarnings a -> Rep (WithJSONWarnings a) x to :: Rep (WithJSONWarnings a) x -> WithJSONWarnings a | |
Show a => Show (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser Methods showsPrec :: Int -> WithJSONWarnings a -> ShowS show :: WithJSONWarnings a -> String showList :: [WithJSONWarnings a] -> ShowS | |
Eq a => Eq (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser Methods (==) :: WithJSONWarnings a -> WithJSONWarnings a -> Bool (/=) :: WithJSONWarnings a -> WithJSONWarnings a -> Bool | |
type Rep (WithJSONWarnings a) Source # | |
Defined in Data.Aeson.WarningParser type Rep (WithJSONWarnings a) = D1 ('MetaData "WithJSONWarnings" "Data.Aeson.WarningParser" "aeson-warning-parser-0.1.1-7eg9NfPxRYBH8gVolgGW79" 'False) (C1 ('MetaCons "WithJSONWarnings" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [JSONWarning]))) |
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 the 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 -> Parser a Source #
Extends the .:
warning to include the field name that failed to parse.
(.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a) Source #
Extends the .:?
warning to include the field name that failed to parse.
(..:) :: FromJSON a => Object -> Text -> WarningParser a Source #
WarningParser
version of .:
.
(...:) :: FromJSON a => Object -> [Text] -> WarningParser a Source #
Synonym version of ..:
.
(..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a) Source #
WarningParser
version of .:?
.
(...:?) :: FromJSON a => Object -> [Text] -> WarningParser (Maybe a) Source #
Synonym version of ..:?
.
(..!=) :: WarningParser (Maybe a) -> a -> WarningParser a Source #
WarningParser
version of .!=
.