`Pantry.Internal.AesonExtended`

The pantry package exposes ‘do not rely on’ module Pantry.Internal.AesonExtended which, essentially, adds the following functionality:

  • type WarningParser a = WriterT WarningParserMonoid Parser a - a JSON parser that warns about unexpected fields in objects (and a lot that flows from that)
  • (.:) :: FromJSON a => Object -> Text -> Parser a - extends the .: warning to include the field name.
  • (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a) - extends the .:? warning to include the field name.

Since it was first published in 2019, the module’s Haddock documentation has said that the intention is to ‘remove the module’. I assume that means either move the functionality to a new package, and/or replace the dependency of Stack/Pantry on it with functionality provided by an existing package that does the same thing.

My questions are these:

  1. is there an existing package that does much the same thing?
  2. if not, is there an existing package where this sort of functionality could be usefully added?
  3. if not, should I seek to move the functionality into a new package? Pantry is not a natural place for people to look if they want to extend Aeson.
2 Likes

Having searched for aeson on Hackage (184 entries), and read many of the packages with likely names, I think the answer is a new package. I am going to call it aeson-warning-parser.