Mon Oct 16 15:54:05 UTC 2023 - Peter Simons <psimons@suse.com>
- Update aeson to version 2.2.1.0 revision 1.
### 2.2.1.0
* Add `Data.Aeson.RFC8785`, a JSON Canonicalization Scheme implementation
https://datatracker.ietf.org/doc/html/rfc8785
* Add Data.Aeson.Decoding.Text, decodeStrictText :: Text -> ...
We avoid intermediate `ByteString` copy by not doing
`decode . TE.encodeUtf8`, but instead working on `Text` value directly.
As we know that the stream is valid Unicode (UTF8 or UTF16),
we can also take some shortcuts.
One gotcha is that internal `Text` values (in `Key`s or `Value` `String`s)
will most likely retain the original input `Text` value (its underlying `Array`).
It shouldn't be an issue if the `Value` is then decoded to something else so these
`Text` values disapper, but if not (e.g. `Object` keys survive)
then users might want to use `Data.Text.copy`.
### 2.2.0.0
* Rework how `omitNothingFields` works. Add `allowOmittedFields` as a parsing counterpart.
New type-class members were added: `omitField :: a -> Bool` to `ToJSON` and `omittedField :: Maybe a` to `FromJSON`.
These control which fields can be omitted.
The `.:?=`, `.:!=` and `.?=` operators were added to make use of these new members.
GHC.Generics and Template Haskell deriving has been updated accordingly.
Note: They behave as the parsers have been written with `.:!=`, i.e.
if the field value is `null` it's passed to the underlying parser.
This doesn't make difference for `Maybe` or `Option`, but does make for
types which parser doesn't accept `null`.
(`()` parser accepts everything and `Proxy` accepts `null).
In addition to `Maybe` (and `Option`) fields the `Data.Monoid.First` and `Data.Monoid.Last` are also omitted,
as well as the most newtype wrappers, when their wrap omittable type (e.g. newtypes in `Data.Monoid` and `Data.Semigroup`, `Identity`, `Const`, `Tagged`, `Compose`).
Additionall "boring" types like `()` and `Proxy` are omitted as well.
As the omitting is now uniform, type arguments are also omitted (also in `Generic1` derived instance).
Resolves issues:
- [#687](https://github.com/haskell/aeson/issues/687) Derived ToJSON1 instance does not respect omitNothingFields = True,
- [#571](https://github.com/haskell/aeson/issues/571) omitNothingFields not used in Generic Decode,
- [#792](https://github.com/haskell/aeson/issues/792) Make Proxy fields optional.
* Use `Data.Aeson.Decoding` parsing functions (introduced in version 2.1.2.0) as default in `Data.Aeson`.
As one side-effect, `decode` and `decode'` etc pair functions are operationally the same.
All variants use an intermediate `Value` in normal form.
The lazier variant could had `Value` thunks inside `Array` (i.e. `Vector`), but the record had been value strict since version `0.4.0.0` (before that the lazy `Data.Map` was used as `Object`).
* Move `Data.Aeson.Parser` module into separate [`attoparsec-aeson`](https://hackage.haskell.org/package/attoparsec-aeson) package, as these parsers are not used by `aeson` itself anymore.
* Use [`text-iso8601`](https://hackage.haskell.org/package/text-iso8601) package for parsing `time` types. These are slightly faster than previously used (copy of) `attoparsec-iso8601`.
Formats accepted is slightly changed:
- The space between time and timezone offset (in `UTCTime` and `ZonedTime`) is disallowed. ISO8601 explictly forbidds it.
- The timezone offsets can be in range -23:59..23:59. This is how Python, joda-time etc seems to do. (Previously the range was -12..+14)
* Remove internal `Data.Aeson.Internal` and `Data.Aeson.Internal.Time` modules. Everything from the former is exported elsewhere (`Data.Aeson.Types`), the latter was truly internal.
* Remove `cffi` flag. Toggling the flag made `aeson` use a C implementation for string unescaping (used for `text <2` versions).
The new native Haskell implementation (introduced in version 2.0.3.0) is at least as fast.
* Drop instances for `Number` from `attoparsec` package.
* Improve `Arbitrary Value` instance.
* Add instances for `URI` from `network-uri`.
* add instances for `Down` from `Data.Ord`.
* Use `integer-conversion` for converting `Text` and `ByteString`s into `Integer`s.
* Bump lower bounds of non GHC-boot lib dependencies.
* Add instances for `these`, thanks to Oleg Grenrus.
## 1.5.0.0
* Fix bug in `rejectUnknownFields` not respecting `fieldLabelModifier`, thanks to Markus Schirp.
* `GFromJSON` members are no longer exported from `Data.Aeson(.Types)`, if you are using `gParseJSON` consider switching to `gParseJSON'`, thanks to Oleg Grenrus.
* Aeson no longer accepts unescaped control characters, thanks to Oleg Grenrus.
* Remove `CoerceText` since GHC >=7.8 has `Coercible`, thanks to Oleg Grenrus.
* Rename the `GToJSON` class to `GToJSON'` and expose it, thanks to Oleg Grenrus.
* Provide a clearer error message when a required tagKey for a constructor is missing, thanks to Guru Devanla.
The error message now looks like this: `Error in $: parsing Types.SomeType failed, expected Object with key "tag" containing one of ["nullary","unary","product","record","list"], key "tag" not found`
* Add `formatPath` and `formatRelativePath` functions to turn a `JSONPath` into a `String`, thanks to Robbie McMichael
* Expose `(<?>)`, `JSONPath` and `JSONPathElement(..)` from `Data.Aeson.Types`. Previously only available through internal modules. Thanks to Luke Clifton.
* Support for base-compat 0.11, thanks to Ryan Scott.
* Travis build for GHC 8.8, thanks to Oleg Grenrus.
This release introduces bounds on the size of `Scientific` numbers when they are converted to other arbitrary precision types that do not represent them efficiently in memory.
This means that trying to decode a number such as `1e1000000000` into an `Integer` will now fail instead of using a lot of memory. If you need to represent large numbers you can add a newtype (preferably over `Scientific`) and providing a parser using `withScientific`.
The following instances are affected by this:
* `FromJSON Natural`
* `FromJSONKey Natural`
* `FromJSON Integer`
* `FromJSONKey Integer`
* `FromJSON NominalDiffTime`
For the same reasons the following instances & functions have been removed:
* Remove `FromJSON Data.Attoparsec.Number` instance. Note that `Data.Attoparsec.Number` is deprecated.
* Remove deprecated `withNumber`, use `withScientific` instead.
Finally, encoding integral values with large exponents now uses scientific notation, this saves space for large numbers.
### 1.3.1.1
* Catch 0 denominators when parsing Ratio
### 1.3.1.0
* Fix bug in generically derived `FromJSON` instances that are using `unwrapUnaryRecords`, thanks to Xia Li-yao
* Allow base-compat 0.10.*, thanks to Oleg Grenrus
## 1.3.0.0
Breaking changes:
* `GKeyValue` has been renamed to `KeyValuePair`, thanks to Xia Li-yao
* Removed unused `FromJSON` constraint in `withEmbeddedJson`, thanks to Tristan Seligmann
Other improvements:
* Optimizations of TH toEncoding, thanks to Xia Li-yao
* Optimizations of hex decoding when using the default/pure unescape implementation, thanks to Xia Li-yao
* Improved error message on `Day` parse failures, thanks to Gershom Bazerman
* Add `encodeFile` as well as `decodeFile*` variants, thanks to Markus Hauck
* Add `Ord` instance for `JSONPathElement`, thanks to Simon Hengel.
* Added `withEmbeddedJSON` to help parse JSON embedded inside a JSON string, thanks to Jesse Kempf.
* Memory usage improvements to the default (pure) parser, thanks to Jonathan Paugh. Also thanks to Neil Mitchell & Oleg Grenrus for contributing a benchmark.
* `omitNothingFields` now works for the `Option` newtype, thanks to Xia Li-yao.
* Some documentation fixes, thanks to Jonathan Paug & Philippe Crama.
* Add `FromJSON` and `ToJSON` instances for
* `DiffTime`, thanks to Víctor López Juan.
* `CTime`, thanks to Daniel Díaz.
* Fix handling of fractions when parsing Natural, thanks to Yuriy Syrovetskiy.
* Change text in error messages for Integral types to make them follow the common pattern, thanks to Yuriy Syrovetskiy.
* Add missing `INCOHERENT` pragma for `RecordToPair`, thanks to Xia Li-yao.
* Everything related to `Options` is now exported from `Data.Aeson`, thanks to Xia Li-yao.
* Optimizations to not escape text in clear cases, thanks to Oleg Grenrus.
* Some documentation fixes, thanks to Phil de Joux & Xia Li-yao.
* Add `parserThrowError` and `parserCatchError` combinators, thanks to Oleg Grenrus.
* Add `Generic` instance for `Value`, thanks to Xia Li-yao.
* Fix a mistake in the 1.2.0.0 changelog, the `cffi` flag is disabled by default! Thanks to dbaynard.
* `tagSingleConstructors`, an option to encode single-constructor types as tagged sums was added to `Options`. It is disabled by default for backward compatibility.
* The `cffi` flag is now turned off (`False`) by default, this means C FFI code is no longer used by default. You can flip the flag to get C implementation.
* The `Options` constructor is no longer exposed to prevent new options from being breaking changes, use `defaultOptions` instead.
* The contents of `GToJSON` and `GToEncoding` are no longer exposed.
* Some INLINE pragmas were removed to avoid GHC running out of simplifier ticks.