packages feed

hw-aeson 0.1.2.0 → 0.1.3.0

raw patch · 4 files changed

+88/−3 lines, 4 filesdep +text-shortdep +unordered-containersPVP ok

version bump matches the API change (PVP)

Dependencies added: text-short, unordered-containers

API changes (from Hackage documentation)

+ HaskellWorks.Data.Aeson.Compat: keyToString :: Key -> String
+ HaskellWorks.Data.Aeson.Compat: keyToText :: Key -> Text
+ HaskellWorks.Data.Aeson.Compat: stringToKey :: String -> Key
+ HaskellWorks.Data.Aeson.Compat: textToKey :: Text -> Key
+ HaskellWorks.Data.Aeson.Compat: type Key = Key

Files

hw-aeson.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2  name:                   hw-aeson-version:                0.1.2.0+version:                0.1.3.0 synopsis:               Convenience functions for Aeson description:            Convenience functions for Aeson. category:               Data, JSON@@ -28,6 +28,8 @@ common hedgehog                   { build-depends: hedgehog                   >= 0.6        && < 1.3    } common hspec                      { build-depends: hspec                      >= 2.4        && < 3      } common text                       { build-depends: text                       >= 1.2        && < 1.3    }+common text-short                 { build-depends: text-short                 >= 0.1.5      && < 0.2    }+common unordered-containers       { build-depends: unordered-containers       >= 0.2        && < 0.3    }  common config @@ -38,11 +40,15 @@   import:               base, config                       , aeson                       , text+                      , text-short+                      , unordered-containers   other-modules:        Paths_hw_aeson   autogen-modules:      Paths_hw_aeson   hs-source-dirs:       src   default-language:     Haskell2010   exposed-modules:      HaskellWorks.Data.Aeson+                        HaskellWorks.Data.Aeson.Compat+                        HaskellWorks.Data.Aeson.Compat.Map  test-suite hw-aeson-test   import:               base, config
src/HaskellWorks/Data/Aeson.hs view
@@ -11,12 +11,12 @@     , (.!=)     ) where -import Text.Read (readMaybe) import Data.Aeson (pairs, object, KeyValue((.=)), ToJSON(toJSON, toEncoding), Series, Value(Null)) import Data.Aeson.Encoding (Encoding)-import Data.Aeson.Key (Key) import Data.Aeson.Types (Pair, Parser) import Data.Monoid (Endo(..))+import HaskellWorks.Data.Aeson.Compat (Key)+import Text.Read (readMaybe)  infixr 7 .?= infixr 7 .!=
+ src/HaskellWorks/Data/Aeson/Compat.hs view
@@ -0,0 +1,68 @@+{-# LANGUAGE CPP #-}++module HaskellWorks.Data.Aeson.Compat+  ( Key+  , textToKey+  , keyToText+  , stringToKey+  , keyToString+  ) where++import Data.Text (Text)+import Data.Text.Short (ShortText)++import qualified Data.Text as T+import qualified Data.Text.Short as ST++#if MIN_VERSION_aeson(2,0,0)+import qualified Data.Aeson.Key    as J+#endif++#if MIN_VERSION_aeson(2,0,0)+type Key = J.Key+#else+type Key = Text+#endif++textToKey :: Text -> Key+#if MIN_VERSION_aeson(2,0,0)+textToKey = J.fromText+#else+textToKey = id+#endif++keyToText :: Key -> Text+#if MIN_VERSION_aeson(2,0,0)+keyToText = J.toText+#else+keyToText = id+#endif++stringToKey :: String -> Key+#if MIN_VERSION_aeson(2,0,0)+stringToKey = J.fromString+#else+stringToKey = T.pack+#endif++keyToString :: Key -> String+#if MIN_VERSION_aeson(2,0,0)+keyToString = J.toString+#else+keyToString = T.unpack+#endif+++shortTextToKey :: ShortText -> Key+#if MIN_VERSION_aeson(2,0,0)+shortTextToKey = J.fromShortText+#else+shortTextToKey = ST.toText+#endif++keyToShortText :: Key -> ShortText+#if MIN_VERSION_aeson(2,0,0)+keyToShortText = J.toShortText+#else+keyToShortText = ST.fromText+#endif
+ src/HaskellWorks/Data/Aeson/Compat/Map.hs view
@@ -0,0 +1,11 @@+{-# LANGUAGE CPP #-}++module HaskellWorks.Data.Aeson.Compat.Map+  ( module JM+  ) where++#if MIN_VERSION_aeson(2,0,0)+import Data.Aeson.KeyMap as JM+#else+import Data.HashMap.Strict as JM+#endif