stack-1.3.2: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Data.Aeson.Extended

Contents

- Extended failure messages
- JSON Parser that emits warnings

Description

Extensions to Aeson parsing of objects.

Synopsis

- (.:) :: FromJSON a => Object -> Text -> Parser a
- (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)
- data JSONWarning = JSONUnrecognizedFields String [Text]
- 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 :: MonadLogger 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 a #

Extends `.:` warning to include field name.

(.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a) #

Extends `.:?` warning to include field name.

# JSON Parser that emits warnings

data JSONWarning #

Warning output from `WarningParser`.

Constructors

JSONUnrecognizedFields String [Text] |

Instances

Show JSONWarning # |
Methods showsPrec :: Int -> JSONWarning -> ShowS # show :: JSONWarning -> String # showList :: [JSONWarning] -> ShowS #

type WarningParser a = WriterT WarningParserMonoid Parser a #

JSON parser that warns about unexpected fields in objects.

data WithJSONWarnings a #

Constructors

WithJSONWarnings a [JSONWarning] |

Instances

Functor WithJSONWarnings # |
Methods fmap :: (a -> b) -> WithJSONWarnings a -> WithJSONWarnings b # (<$) :: a -> WithJSONWarnings b -> WithJSONWarnings a #
Generic (WithJSONWarnings a) # |
Associated Types type Rep (WithJSONWarnings a) :: * -> * # Methods from :: WithJSONWarnings a -> Rep (WithJSONWarnings a) x # to :: Rep (WithJSONWarnings a) x -> WithJSONWarnings a #
Monoid a => Monoid (WithJSONWarnings a) # |
Methods mempty :: WithJSONWarnings a # mappend :: WithJSONWarnings a -> WithJSONWarnings a -> WithJSONWarnings a # mconcat :: [WithJSONWarnings a] -> WithJSONWarnings a #
FromJSON (WithJSONWarnings (CustomSnapshot, Maybe Resolver)) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings (CustomSnapshot, Maybe Resolver)) # parseJSONList :: Value -> Parser [WithJSONWarnings (CustomSnapshot, Maybe Resolver)] #
FromJSON (WithJSONWarnings (ResolverThat's NotLoaded)) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings (ResolverThat's NotLoaded)) # parseJSONList :: Value -> Parser [WithJSONWarnings (ResolverThat's NotLoaded)] #
FromJSON (WithJSONWarnings UrlsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings UrlsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings UrlsMonoid] #
FromJSON (WithJSONWarnings Urls) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings Urls) # parseJSONList :: Value -> Parser [WithJSONWarnings Urls] #
FromJSON (WithJSONWarnings DockerOptsMonoid) # | Decode uninterpreted docker options from JSON/YAML.
Methods parseJSON :: Value -> Parser (WithJSONWarnings DockerOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings DockerOptsMonoid] #
FromJSON (WithJSONWarnings NixOptsMonoid) # | Decode uninterpreted nix options from JSON/YAML.
Methods parseJSON :: Value -> Parser (WithJSONWarnings NixOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings NixOptsMonoid] #
FromJSON (WithJSONWarnings ImageOptsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings ImageOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings ImageOptsMonoid] #
FromJSON (WithJSONWarnings ImageDockerOpts) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings ImageDockerOpts) # parseJSONList :: Value -> Parser [WithJSONWarnings ImageDockerOpts] #
FromJSON (WithJSONWarnings BenchmarkOptsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings BenchmarkOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings BenchmarkOptsMonoid] #
FromJSON (WithJSONWarnings HaddockOptsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings HaddockOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings HaddockOptsMonoid] #
FromJSON (WithJSONWarnings TestOptsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings TestOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings TestOptsMonoid] #
FromJSON (WithJSONWarnings BuildOptsMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings BuildOptsMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings BuildOptsMonoid] #
FromJSON (WithJSONWarnings PackageIndex) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings PackageIndex) # parseJSONList :: Value -> Parser [WithJSONWarnings PackageIndex] #
FromJSON (WithJSONWarnings SetupInfoLocation) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings SetupInfoLocation) # parseJSONList :: Value -> Parser [WithJSONWarnings SetupInfoLocation] #
FromJSON (WithJSONWarnings SetupInfo) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings SetupInfo) # parseJSONList :: Value -> Parser [WithJSONWarnings SetupInfo] #
FromJSON (WithJSONWarnings GHCDownloadInfo) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings GHCDownloadInfo) # parseJSONList :: Value -> Parser [WithJSONWarnings GHCDownloadInfo] #
FromJSON (WithJSONWarnings VersionedDownloadInfo) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings VersionedDownloadInfo) # parseJSONList :: Value -> Parser [WithJSONWarnings VersionedDownloadInfo] #
FromJSON (WithJSONWarnings DownloadInfo) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings DownloadInfo) # parseJSONList :: Value -> Parser [WithJSONWarnings DownloadInfo] #
FromJSON (WithJSONWarnings ProjectAndConfigMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings ProjectAndConfigMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings ProjectAndConfigMonoid] #
FromJSON (WithJSONWarnings ConfigMonoid) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings ConfigMonoid) # parseJSONList :: Value -> Parser [WithJSONWarnings ConfigMonoid] #
FromJSON (WithJSONWarnings PackageLocation) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings PackageLocation) # parseJSONList :: Value -> Parser [WithJSONWarnings PackageLocation] #
FromJSON (WithJSONWarnings PackageEntry) # |
Methods parseJSON :: Value -> Parser (WithJSONWarnings PackageEntry) # parseJSONList :: Value -> Parser [WithJSONWarnings PackageEntry] #
type Rep (WithJSONWarnings a) # |
type Rep (WithJSONWarnings a) = D1 (MetaData "WithJSONWarnings" "Data.Aeson.Extended" "stack-1.3.2-BJTOe4yfRNq2cDDPL8b7LK" False) (C1 (MetaCons "WithJSONWarnings" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [JSONWarning]))))

withObjectWarnings :: String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a) #

`WarningParser` version of `withObject`.

jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a #

Handle warnings in a sub-object.

jsonSubWarningsT :: Traversable t => WarningParser (t (WithJSONWarnings a)) -> WarningParser (t a) #

Handle warnings in a `Traversable` of sub-objects.

jsonSubWarningsTT :: (Traversable t, Traversable u) => WarningParser (u (t (WithJSONWarnings a))) -> WarningParser (u (t a)) #

Handle warnings in a `Maybe Traversable` of sub-objects.

logJSONWarnings :: MonadLogger m => FilePath -> [JSONWarning] -> m () #

Log JSON warnings.

noJSONWarnings :: a -> WithJSONWarnings a #

tellJSONField :: Text -> WarningParser () #

Tell warning parser about an expected field, so it doesn't warn about it.

unWarningParser :: WarningParser a -> Parser a #

Convert a `WarningParser` to a `Parser`.

(..:) :: FromJSON a => Object -> Text -> WarningParser a #

`WarningParser` version of `.:`.

(..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a) #

`WarningParser` version of `.:?`.

(..!=) :: WarningParser (Maybe a) -> a -> WarningParser a #

`WarningParser` version of `.!=`.