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.
This commit is contained in:
parent
55f71b0ebd
commit
ca596e7c54
5 changed files with 51 additions and 15 deletions
|
@ -7,7 +7,7 @@
|
|||
- License: BSD-2-clause
|
||||
-}
|
||||
|
||||
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
|
||||
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances, CPP #-}
|
||||
|
||||
module Utility.Aeson (
|
||||
module X,
|
||||
|
@ -17,7 +17,7 @@ module Utility.Aeson (
|
|||
packByteString,
|
||||
) where
|
||||
|
||||
import Data.Aeson as X hiding (ToJSON, toJSON, encode)
|
||||
import Data.Aeson as X hiding (ToJSON, toJSON, encode, Key)
|
||||
import Data.Aeson hiding (encode)
|
||||
import qualified Data.Aeson
|
||||
import qualified Data.Text as T
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue