packages feed

aeson-extra 0.4.1.2 → 0.4.1.3

raw patch · 7 files changed

+57/−42 lines, 7 filesdep +bifunctorsdep −aligndep ~aesondep ~basedep ~recursion-schemesPVP ok

version bump matches the API change (PVP)

Dependencies added: bifunctors

Dependencies removed: align

Dependency ranges changed: aeson, base, recursion-schemes, semialign, tasty, template-haskell, these

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.4.1.3 (2019-10-21)++- support semialign-1.1+- drop spurious dependency from test-suite+ # 0.4.1.2 (2019-06-02)  - these-1 support
aeson-extra.cabal view
@@ -1,6 +1,6 @@ cabal-version:      >=1.10 name:               aeson-extra-version:            0.4.1.2+version:            0.4.1.3 synopsis:           Extra goodies for aeson description:   Package provides extra functionality on top of @aeson@ and @aeson-compat@@@ -13,7 +13,14 @@ license:            BSD3 license-file:       LICENSE tested-with:-  GHC ==8.8.1 || ==8.6.5 || ==8.4.4 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3+  GHC ==7.6.3+   || ==7.8.4+   || ==7.10.3+   || ==8.0.2+   || ==8.2.2+   || ==8.4.4+   || ==8.6.5+   || ==8.8.1  build-type:         Simple extra-source-files:@@ -32,24 +39,27 @@     , aeson-compat           >=0.3.0.0  && <0.4     , attoparsec             >=0.11.3.4 && <0.14     , attoparsec-iso8601     >=1.0      && <1.1-    , base                   >=4.6      && <4.13-    , base-compat-batteries  >=0.10.1   && <0.11+    , base                   >=4.6      && <4.14+    , base-compat-batteries  >=0.10.1   && <0.12     , bytestring             >=0.10     && <0.11     , containers             >=0.5      && <0.7     , deepseq                >=1.3      && <1.5     , exceptions             >=0.8      && <0.11-    , hashable               >=1.2      && <1.3+    , hashable               >=1.2      && <1.4     , parsec                 >=3.1.9    && <3.2     , recursion-schemes      >=4.1.2    && <5.2     , scientific             >=0.3      && <0.4-    , semialign              >=1        && <1.1-    , template-haskell       >=2.8      && <2.15+    , semialign              >=1        && <1.2+    , template-haskell       >=2.8      && <2.16     , text                   >=1.2      && <1.3     , these                  >=1        && <1.1-    , time                   >=1.4.0.1  && <1.9+    , time                   >=1.4.0.1  && <1.10     , unordered-containers   >=0.2      && <0.3     , vector                 >=0.10     && <0.13 +  if !impl(ghc >=8.2)+    build-depends: bifunctors >=5.5.2 && <5.6+   if impl(ghc >=7.8)     exposed-modules:       Data.Aeson.Extra.SingObject@@ -75,7 +85,6 @@   ghc-options:      -Wall   build-depends:       aeson-extra-    , align     , base     , containers     , quickcheck-instances  >=0.3     && <0.4
src/Data/Aeson/Extra.hs view
@@ -49,7 +49,7 @@   module Data.Aeson.Compat,   ) where -import Prelude        ()+import Prelude () import Prelude.Compat  import Data.Aeson.Compat@@ -58,12 +58,12 @@ import qualified Data.ByteString.Lazy as LBS  import Data.Aeson.Extra.CollapsedList-import Data.Aeson.Extra.Recursive import Data.Aeson.Extra.Map import Data.Aeson.Extra.Merge+import Data.Aeson.Extra.Recursive import Data.Aeson.Extra.Stream-import Data.Aeson.Extra.Time import Data.Aeson.Extra.TH+import Data.Aeson.Extra.Time  #if MIN_VERSION_base(4,7,0) import Data.Aeson.Extra.SingObject
src/Data/Aeson/Extra/CollapsedList.hs view
@@ -31,7 +31,7 @@ #endif  import qualified Data.Foldable       as Foldable-import qualified Data.HashMap.Strict as H+import qualified Data.HashMap.Strict as HM  #if MIN_VERSION_aeson(0,10,0) import qualified Data.Text as T@@ -107,7 +107,7 @@ -- > Just (V [1,2,3,4]) parseCollapsedList :: (FromJSON a, FromJSON1 f, Alternative f) => Object -> Text -> Parser (f a) parseCollapsedList obj key =-    case H.lookup key obj of+    case HM.lookup key obj of         Nothing   -> pure Control.Applicative.empty         Just v    -> modifyFailure addKeyName $ (getCollapsedList <$> parseJSON v) -- <?> Key key   where@@ -147,7 +147,7 @@ -- > Just (V [1,2,3,4]) parseCollapsedList :: (FromJSON a, FromJSON (f a), Alternative f) => Object -> Text -> Parser (f a) parseCollapsedList obj key =-    case H.lookup key obj of+    case HM.lookup key obj of         Nothing   -> pure Control.Applicative.empty #if MIN_VERSION_aeson(0,10,0)         Just v    -> modifyFailure addKeyName $ (getCollapsedList <$> parseJSON v) -- <?> Key key
src/Data/Aeson/Extra/Map.hs view
@@ -33,10 +33,10 @@ import Data.Text             (Text) import Data.Typeable         (Typeable) -import qualified Data.HashMap.Strict as H+import qualified Data.HashMap.Strict as HM import qualified Data.Map            as Map import qualified Data.Text           as T-import qualified Data.Text.Lazy      as TL+import qualified Data.Text.Lazy      as LT import qualified Data.Text.Read      as T  -- | A wrapper type to parse arbitrary maps@@ -51,26 +51,26 @@   parseJSONKey :: Text -> Parser a  instance FromJSONKey Text where parseJSONKey = pure-instance FromJSONKey TL.Text where parseJSONKey = pure . TL.fromStrict+instance FromJSONKey LT.Text where parseJSONKey = pure . LT.fromStrict instance FromJSONKey String where parseJSONKey = pure . T.unpack instance FromJSONKey Int where parseJSONKey = parseIntegralJSONKey instance FromJSONKey Integer where parseJSONKey = parseIntegralJSONKey  parseIntegralJSONKey :: Integral a => Text -> Parser a-parseIntegralJSONKey t = case (T.signed T.decimal) t of+parseIntegralJSONKey t = case T.signed T.decimal t of   Right (v, left) | T.null left  -> pure v                   | otherwise    -> fail $ "Garbage left: " <> T.unpack left   Left err                       -> fail err  class FromJSONMap m k v | m -> k v where-  parseJSONMap :: H.HashMap Text Value -> Parser m+  parseJSONMap :: HM.HashMap Text Value -> Parser m -instance (Eq k, Hashable k, FromJSONKey k, FromJSON v) => FromJSONMap (H.HashMap k v) k v where-  parseJSONMap = fmap H.fromList . traverse f . H.toList+instance (Eq k, Hashable k, FromJSONKey k, FromJSON v) => FromJSONMap (HM.HashMap k v) k v where+  parseJSONMap = fmap HM.fromList . traverse f . HM.toList     where f (k, v) = (,) <$> parseJSONKey k <*> parseJSON v  instance (Ord k, FromJSONKey k, FromJSON v) => FromJSONMap (Map.Map k v) k v where-  parseJSONMap = fmap Map.fromList . traverse f . H.toList+  parseJSONMap = fmap Map.fromList . traverse f . HM.toList     where f (k, v) = (,) <$> parseJSONKey k <*> parseJSON v  instance (FromJSONMap m k v) => FromJSON (M m) where@@ -81,20 +81,20 @@   toJSONKey :: a -> Text  instance ToJSONKey Text where toJSONKey = id-instance ToJSONKey TL.Text where toJSONKey = TL.toStrict+instance ToJSONKey LT.Text where toJSONKey = LT.toStrict instance ToJSONKey String where toJSONKey = T.pack instance ToJSONKey Int where toJSONKey = T.pack . show instance ToJSONKey Integer where toJSONKey = T.pack . show  class ToJSONMap m k v | m -> k v where-  toJSONMap :: m -> H.HashMap Text Value+  toJSONMap :: m -> HM.HashMap Text Value -instance (ToJSONKey k, ToJSON v) => ToJSONMap (H.HashMap k v) k v where-  toJSONMap = H.fromList . fmap f . H.toList+instance (ToJSONKey k, ToJSON v) => ToJSONMap (HM.HashMap k v) k v where+  toJSONMap = HM.fromList . fmap f . HM.toList     where f (k, v) = (toJSONKey k, toJSON v)  instance (ToJSONKey k, ToJSON v) => ToJSONMap (Map.Map k v) k v where-  toJSONMap = H.fromList . fmap f . Map.toList+  toJSONMap = HM.fromList . fmap f . Map.toList     where f (k, v) = (toJSONKey k, toJSON v)  instance (ToJSONMap m k v) => ToJSON (M m) where
src/Data/Aeson/Extra/Stream.hs view
@@ -28,12 +28,12 @@         A.Done bs' _    -> first bs'         A.Fail _ _ err  -> ([], Just err)     first bs = case A.parse (lexemeChar ']') bs of-        A.Done _ _      -> ([], Nothing)-        A.Fail _ _ _    -> go bs+        A.Done {}       -> ([], Nothing)+        A.Fail {}       -> go bs     go bs = case A.parse valueEnd bs of         A.Done _   (r, False) -> ([r], Nothing)         A.Done bs' (r, True)  -> case go bs' of-            ~(rs, end)   -> (r:rs, end)+            ~(rs, end)  -> (r:rs, end)         A.Fail _ _ err  -> ([], Just err)     valueEnd = do         v <- value
src/Data/Aeson/Extra/TH.hs view
@@ -15,22 +15,23 @@     mkValue',     ) where -import           Data.Aeson.Compat-import qualified Data.Text           as T-import qualified Data.Text.Encoding  as TE-import           Language.Haskell.TH+import Data.Aeson.Compat+import Language.Haskell.TH +import qualified Data.Text          as T+import qualified Data.Text.Encoding as TE+ #if !MIN_VERSION_aeson_compat(0,3,5)-import           Data.Aeson.Types (Parser)+import Data.Aeson.Types (Parser) #endif  #if !MIN_VERSION_aeson(0,11,0)-import           Control.Arrow              (first)-import qualified Data.HashMap.Strict        as HM-import           Data.Scientific-                 (base10Exponent, coefficient, scientific)-import qualified Data.Vector                as V-import           Language.Haskell.TH.Syntax (Lift (..))+import Data.Bifunctor             (first)+import Data.Scientific            (base10Exponent, coefficient, scientific)+import Language.Haskell.TH.Syntax (Lift (..))++import qualified Data.HashMap.Strict as HM+import qualified Data.Vector         as V #endif  -- | Create a 'Value' from string representation.