allow building with aeson >= 2.0
authorsternenseemann <sternenseemann@systemli.org>
Wed, 2 Mar 2022 20:16:10 +0000 (21:16 +0100)
committerJoey Hess <joeyh@joeyh.name>
Wed, 2 Mar 2022 22:01:41 +0000 (18:01 -0400)
commitca596e7c54ed08e2bec3b6b3e669ccf5ded9aff8
treeef3ca5085c23c45e773172f974baa8215d027614
parent55f71b0ebd4c6a80394274ddcff214c06e53b13e
allow building with aeson >= 2.0

In aeson 2.0, Text has been replaced by the Key type and HashMap by the
KeyMap interface. Accomodating this required adding some CPP in order to
still be able to compile with aeson < 2.0. The required changes were:

* Prevent Key from being re-exported by Utilities.Aeson, as it clashes
  with git-annex's own Key type.

* Fix up convertion from String/Text to Key (or Text in aeson 1.*) in a
  couple of places

* Import Data.Aeson.KeyMap instead of Data.HashMap.Strict, as they are
  mostly API-compatible. insertWith needs to be replaced by unionWith,
  however, as KeyMap lacks the former function.
Command/Info.hs
Messages/JSON.hs
Remote.hs
Types/MetaData.hs
Utility/Aeson.hs