commit ghc-aeson-compat for openSUSE:Factory

Hello community, here is the log from the commit of package ghc-aeson-compat for openSUSE:Factory checked in at 2016-03-31 13:02:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-aeson-compat (Old) and /work/SRC/openSUSE:Factory/.ghc-aeson-compat.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-aeson-compat" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-aeson-compat/ghc-aeson-compat.changes 2016-02-17 12:11:35.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-aeson-compat.new/ghc-aeson-compat.changes 2016-03-31 13:02:28.000000000 +0200 @@ -1,0 +2,10 @@ +Tue Mar 29 06:48:01 UTC 2016 - mimi.vx@gmail.com + +- update to 0.3.2.0 + +------------------------------------------------------------------- +Fri Mar 25 08:20:45 UTC 2016 - mimi.vx@gmail.com + +- allow aeson-0.11.1 + +------------------------------------------------------------------- Old: ---- aeson-compat-0.3.1.0.tar.gz New: ---- aeson-compat-0.3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-aeson-compat.spec ++++++ --- /var/tmp/diff_new_pack.99nhtK/_old 2016-03-31 13:02:29.000000000 +0200 +++ /var/tmp/diff_new_pack.99nhtK/_new 2016-03-31 13:02:29.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-aeson-compat # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ %bcond_with tests Name: ghc-aeson-compat -Version: 0.3.1.0 +Version: 0.3.2.0 Release: 0 Summary: Compatibility layer for aeson Group: System/Libraries @@ -37,17 +37,22 @@ # Begin cabal-rpm deps: BuildRequires: ghc-aeson-devel BuildRequires: ghc-attoparsec-devel +BuildRequires: ghc-base-compat-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-exceptions-devel BuildRequires: ghc-hashable-devel BuildRequires: ghc-scientific-devel +BuildRequires: ghc-semigroups-devel +BuildRequires: ghc-tagged-devel BuildRequires: ghc-text-devel BuildRequires: ghc-time-devel BuildRequires: ghc-time-locale-compat-devel BuildRequires: ghc-unordered-containers-devel BuildRequires: ghc-vector-devel %if %{with tests} +BuildRequires: ghc-QuickCheck-devel +BuildRequires: ghc-base-orphans-devel BuildRequires: ghc-quickcheck-instances-devel BuildRequires: ghc-tasty-devel BuildRequires: ghc-tasty-hunit-devel ++++++ aeson-compat-0.3.1.0.tar.gz -> aeson-compat-0.3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aeson-compat-0.3.1.0/CHANGELOG.md new/aeson-compat-0.3.2.0/CHANGELOG.md --- old/aeson-compat-0.3.1.0/CHANGELOG.md 2016-02-09 14:03:41.000000000 +0100 +++ new/aeson-compat-0.3.2.0/CHANGELOG.md 2016-03-27 17:28:25.000000000 +0200 @@ -1,3 +1,8 @@ +# 0.3.2.0 + +- Introduce instances from `aeson-0.11.1.0`: `Const`, `Tagged`, `Proxy` and `NonEmpty` +- Fix bug with `Natural` instance, `aeson-0.11.1.0` and `base <=4.7` + # 0.3.1.0 - `aeson-0.11` support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aeson-compat-0.3.1.0/aeson-compat.cabal new/aeson-compat-0.3.2.0/aeson-compat.cabal --- old/aeson-compat-0.3.1.0/aeson-compat.cabal 2016-02-09 14:03:41.000000000 +0100 +++ new/aeson-compat-0.3.2.0/aeson-compat.cabal 2016-03-27 17:28:25.000000000 +0200 @@ -1,9 +1,9 @@ --- This file has been generated from package.yaml by hpack version 0.8.0. +-- This file has been generated from package.yaml by hpack version 0.11.2. -- -- see: https://github.com/sol/hpack name: aeson-compat -version: 0.3.1.0 +version: 0.3.2.0 synopsis: Compatibility layer for aeson description: Compatibility layer for @aeson@ category: Web @@ -31,7 +31,8 @@ ghc-options: -Wall build-depends: base >=4.6 && <4.10 - , aeson >=0.7.0.6 && <0.11.1 + , base-compat >=0.6.0 && <0.10 + , aeson >=0.7.0.6 && <0.11.2 , attoparsec >=0.12 && <0.14 , bytestring >=0.10 && <0.11 , containers >=0.5 && <0.6 @@ -44,6 +45,8 @@ , time-locale-compat >=0.1.0.1 && <0.2 , unordered-containers >=0.2 && <0.3 , vector >=0.10 && <0.12 + , semigroups >=0.16.2.2 && <0.19 + , tagged >=0.7.3 && <0.9 exposed-modules: Data.Aeson.Compat other-modules: @@ -58,7 +61,8 @@ ghc-options: -Wall build-depends: base >=4.6 && <4.10 - , aeson >=0.7.0.6 && <0.11.1 + , base-compat >=0.6.0 && <0.10 + , aeson >=0.7.0.6 && <0.11.2 , attoparsec >=0.12 && <0.14 , bytestring >=0.10 && <0.11 , containers >=0.5 && <0.6 @@ -71,7 +75,10 @@ , time-locale-compat >=0.1.0.1 && <0.2 , unordered-containers >=0.2 && <0.3 , vector >=0.10 && <0.12 + , semigroups >=0.16.2.2 && <0.19 + , tagged >=0.7.3 && <0.9 , aeson-compat + , base-orphans >=0.4.5 && <0.6 , tasty >=0.10 && <0.12 , tasty-hunit >=0.9 && <0.10 , tasty-quickcheck >=0.8 && <0.9 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aeson-compat-0.3.1.0/src/Data/Aeson/Compat.hs new/aeson-compat-0.3.2.0/src/Data/Aeson/Compat.hs --- old/aeson-compat-0.3.1.0/src/Data/Aeson/Compat.hs 2016-02-09 14:03:41.000000000 +0100 +++ new/aeson-compat-0.3.2.0/src/Data/Aeson/Compat.hs 2016-03-27 17:28:25.000000000 +0200 @@ -33,13 +33,8 @@ module Data.Aeson, ) where -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative -#endif - -#if MIN_VERSION_aeson(0,10,0) -import Data.Monoid -#endif +import Prelude () +import Prelude.Compat import Data.Aeson hiding ((.:?), decode, decode', decodeStrict, decodeStrict' @@ -79,6 +74,16 @@ import Text.ParserCombinators.ReadP (readP_to_S) #endif +#if !MIN_VERSION_aeson(0,11,1) +import Control.Applicative (Const (..)) +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Proxy (Proxy (..)) +import Data.Tagged (Tagged (..)) + +import qualified Data.List.NonEmpty as NonEmpty +import qualified Data.Vector as V +#endif + -- | Exception thrown by 'decode' - family of functions in this module. newtype AesonException = AesonException String deriving (Show, Typeable) @@ -123,7 +128,7 @@ #if MIN_VERSION_aeson(0,10,0) modifyFailure addKeyName $ parseJSON v -- <?> Key key where - addKeyName = (("failed to parse field " <> T.unpack key <> ": ") <>) + addKeyName = mappend $ mconcat ["failed to parse field ", T.unpack key, ": "] #else parseJSON v #endif @@ -139,7 +144,7 @@ #if MIN_VERSION_aeson(0,10,0) modifyFailure addKeyName $ Just <$> parseJSON v -- <?> Key key where - addKeyName = (("failed to parse field " <> T.unpack key <> ": ") <>) + addKeyName = mappend $ mconcat ["failed to parse field ", T.unpack key, ": "] #else Just <$> parseJSON v #endif @@ -221,6 +226,7 @@ -- Instances in aeson-0.11 ----------------------------------------------------------------------- +#if !(MIN_VERSION_aeson(0,11,1)) #if !(MIN_VERSION_aeson(0,11,0) && MIN_VERSION_base(4,8,0)) instance ToJSON Natural where toJSON = toJSON . toInteger @@ -237,6 +243,7 @@ then fail $ "Expected a Natural number but got the negative number: " ++ show s else pure $ truncate s #endif +#endif #if !MIN_VERSION_aeson(0,11,0) instance ToJSON Version where @@ -276,3 +283,58 @@ "GT" -> return GT _ -> fail "Parsing Ordering value failed: expected \"LT\", \"EQ\", or \"GT\"" #endif + +#if !MIN_VERSION_aeson(0,11,1) +instance ToJSON (Proxy a) where + toJSON _ = Null + {-# INLINE toJSON #-} + + -- No 'toEncoding', default is good enough + +instance FromJSON (Proxy a) where + {-# INLINE parseJSON #-} + parseJSON Null = pure Proxy + parseJSON v = typeMismatch "Proxy" v + +instance ToJSON b => ToJSON (Tagged a b) where + toJSON (Tagged x) = toJSON x + {-# INLINE toJSON #-} + +#if MIN_VERSION_aeson(0,10,0) + toEncoding (Tagged x) = toEncoding x + {-# INLINE toEncoding #-} +#endif + +instance FromJSON b => FromJSON (Tagged a b) where + {-# INLINE parseJSON #-} + parseJSON = fmap Tagged . parseJSON + +instance ToJSON a => ToJSON (Const a b) where + toJSON (Const x) = toJSON x + {-# INLINE toJSON #-} + +#if MIN_VERSION_aeson(0,10,0) + toEncoding (Const x) = toEncoding x + {-# INLINE toEncoding #-} +#endif + +instance FromJSON a => FromJSON (Const a b) where + {-# INLINE parseJSON #-} + parseJSON = fmap Const . parseJSON + +instance (ToJSON a) => ToJSON (NonEmpty a) where + toJSON = toJSON . NonEmpty.toList + {-# INLINE toJSON #-} + +#if MIN_VERSION_aeson(0,10,0) + toEncoding = toEncoding . NonEmpty.toList + {-# INLINE toEncoding #-} +#endif + +instance (FromJSON a) => FromJSON (NonEmpty a) where + parseJSON = withArray "NonEmpty a" $ + (>>= ne) . traverse parseJSON . V.toList + where + ne [] = fail "Expected a NonEmpty but got an empty list" + ne (x:xs) = pure (x :| xs) +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aeson-compat-0.3.1.0/test/Orphans.hs new/aeson-compat-0.3.2.0/test/Orphans.hs --- old/aeson-compat-0.3.1.0/test/Orphans.hs 2016-02-09 14:03:41.000000000 +0100 +++ new/aeson-compat-0.3.2.0/test/Orphans.hs 2016-03-27 17:28:25.000000000 +0200 @@ -2,21 +2,35 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Orphans where -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative -#endif +import Prelude () +import Prelude.Compat -import Data.Vector as V -import Data.Version (Version(..)) +import Data.Version (Version (..)) import Test.Tasty.QuickCheck +import Data.Orphans () +import Test.QuickCheck.Instances () + +#if !MIN_VERSION_quickcheck_instances(0,3,12) +import Data.Vector as V +#endif + +#if !MIN_VERSION_QuickCheck(2,8,3) +import Control.Applicative (Const (..)) +import Data.List.NonEmpty (NonEmpty (..)) +import Data.Proxy (Proxy (..)) +import Data.Tagged (Tagged (..)) +#endif + #if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0)) -import Numeric.Natural (Natural) +import Numeric.Natural (Natural) #endif +#if !MIN_VERSION_quickcheck_instances(0,3,12) instance Arbitrary a => Arbitrary (Vector a) where arbitrary = V.fromList <$> arbitrary shrink = fmap V.fromList . shrink . V.toList +#endif #if !(MIN_VERSION_QuickCheck(2,8,0) && MIN_VERSION_base(4,8,0)) instance Arbitrary Natural where @@ -28,3 +42,20 @@ x <- fmap abs arbitrary xs <- (fmap . fmap) abs arbitrary return $ Version (x : xs) [] + +#if !MIN_VERSION_QuickCheck(2,8,3) +instance Arbitrary a => Arbitrary (NonEmpty a) where + arbitrary = do + x <- arbitrary + xs <- arbitrary + return (x :| xs) + +instance Arbitrary a => Arbitrary (Tagged t a) where + arbitrary = fmap Tagged arbitrary + +instance Arbitrary a => Arbitrary (Const a b) where + arbitrary = fmap Const arbitrary + +instance Arbitrary (Proxy a) where + arbitrary = return Proxy +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aeson-compat-0.3.1.0/test/Tests.hs new/aeson-compat-0.3.2.0/test/Tests.hs --- old/aeson-compat-0.3.1.0/test/Tests.hs 2016-02-09 14:03:41.000000000 +0100 +++ new/aeson-compat-0.3.2.0/test/Tests.hs 2016-03-27 17:28:25.000000000 +0200 @@ -1,19 +1,28 @@ -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Main (main) where -import Data.Time (Day, LocalTime) -import Data.Version (Version) -import Numeric.Natural (Natural) - -import Test.QuickCheck.Instances () -import Test.Tasty -import Test.Tasty.QuickCheck -import Test.Tasty.HUnit +import Prelude () +import Prelude.Compat -import Data.Aeson.Compat +import Control.Applicative (Const) +import Data.List.NonEmpty (NonEmpty) +import Data.Proxy (Proxy) +import Data.Tagged (Tagged) +import Data.Time (Day, LocalTime) +import Data.Version (Version) +import Numeric.Natural (Natural) + +import Data.Orphans () + +import Test.QuickCheck.Instances () +import Test.Tasty +import Test.Tasty.HUnit +import Test.Tasty.QuickCheck -import Orphans () +import Data.Aeson.Compat + +import Orphans () main :: IO () main = defaultMain $ testGroup "Tests" @@ -24,6 +33,10 @@ , testProperty "Version" $ roundtrip (undefined :: Version) , testProperty "Ordering" $ roundtrip (undefined :: Ordering) , testProperty "Natural" $ roundtrip (undefined :: Natural) + , testProperty "Const" $ roundtrip (undefined :: Const Int Int) + , testProperty "Proxy" $ roundtrip (undefined :: Proxy Int) + , testProperty "Tagged" $ roundtrip (undefined :: Tagged Int Int) + , testProperty "NonEmpty" $ roundtrip (undefined :: NonEmpty Int) ] ] @@ -65,7 +78,7 @@ #if MIN_VERSION_aeson(0,10,0) && !MIN_VERSION_aeson(0,11,0) roundtripBroken10 _ x = property $ case eitherDecode . encode $ x of Right y -> False && x == y -- x and y of the same type! - Left _ -> True + Left _ -> True #else roundtripBroken10 = roundtrip #endif
participants (1)
-
root@hilbert.suse.de