diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8b0a9e..cf0a1e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: cabal: name: cabal / ${{ matrix.os }} / ghc ${{ matrix.ghc }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.ghc == '9.10.1' }} + continue-on-error: ${{ matrix.ghc == '9.12.2' }} strategy: matrix: os: @@ -18,11 +18,11 @@ jobs: - macOS-latest cabal: ["latest"] ghc: - - "9.2.8" - "9.4.8" - - "9.6.6" + - "9.6.7" - "9.8.4" - - "9.10.1" + - "9.10.3" + - "9.12.2" steps: - uses: actions/checkout@v4 @@ -64,11 +64,11 @@ jobs: matrix: stack: ["latest"] resolver: - - "--resolver lts-20" # GHC 9.2.8 - "--resolver lts-21" # GHC 9.4.8 - - "--resolver lts-22" # GHC 9.6.6 + - "--resolver lts-22" # GHC 9.6.7 - "--resolver lts-23" # GHC 9.8.4 - - "--resolver nightly" # GHC 9.10.1 + - "--resolver lts-24" # GHC 9.10.3 + - "--resolver nightly" # GHC 9.12.3 steps: - uses: actions/checkout@v4 diff --git a/package.yaml b/package.yaml index adc7d8b..708ed3f 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: safe-json -version: 1.2.1.0 +version: 1.2.1.1 github: "Vlix/safe-json" license: MIT author: "Felix Paulusma" @@ -8,11 +8,11 @@ copyright: "2019 Felix Paulusma" # Metadata used when publishing your package synopsis: Automatic JSON format versioning category: "JSON" -tested-with: GHC == 9.2.8 - , GHC == 9.4.8 - , GHC == 9.6.6 +tested-with: GHC == 9.4.8 + , GHC == 9.6.7 , GHC == 9.8.4 - , GHC == 9.10.1 + , GHC == 9.10.3 + , GHC == 9.12.2 extra-source-files: - README.md @@ -59,7 +59,7 @@ dependencies: - tasty-hunit >= 0.9.2 && < 0.11 - tasty-quickcheck >= 0.8.4 && < 0.12 - text >= 1.2.3 && < 2.2 -- time >= 1.6.0.1 && < 1.15 +- time >= 1.6.0.1 && < 1.16 - unordered-containers >= 0.2.9 && < 0.3 - uuid-types >= 1.0.3 && < 1.1 - vector >= 0.12.0.1 && < 0.14 @@ -95,7 +95,7 @@ tests: - generic-arbitrary >= 0.1.0 && < 1.1 dependencies: - safe-json - - quickcheck-instances >= 0.3.16 && < 0.4 + - quickcheck-instances >= 0.3.16 && < 0.5 - tasty - tasty-hunit - tasty-quickcheck diff --git a/safe-json.cabal b/safe-json.cabal index 4d0179c..7a7fedf 100644 --- a/safe-json.cabal +++ b/safe-json.cabal @@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.36.0. +-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack name: safe-json -version: 1.2.0.2 +version: 1.2.1.1 synopsis: Automatic JSON format versioning description: This library aims to make the updating of JSON formats or contents, while keeping backward compatibility, as painless as possible. The way this is achieved is through versioning and defined migration functions to migrate older (or newer) versions to the one used. . @@ -28,7 +28,7 @@ license: MIT license-file: LICENSE build-type: Simple tested-with: - GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.8 , GHC == 9.6.6 , GHC == 9.8.3 , GHC == 9.10.1 + GHC == 9.4.8 , GHC == 9.6.7 , GHC == 9.8.4 , GHC == 9.10.3 , GHC == 9.12.2 extra-source-files: README.md ChangeLog.md @@ -73,7 +73,7 @@ library , tasty-hunit >=0.9.2 && <0.11 , tasty-quickcheck >=0.8.4 && <0.12 , text >=1.2.3 && <2.2 - , time >=1.6.0.1 && <1.15 + , time >=1.6.0.1 && <1.16 , unordered-containers >=0.2.9 && <0.3 , uuid-types >=1.0.3 && <1.1 , vector >=0.12.0.1 && <0.14 @@ -105,7 +105,7 @@ test-suite safe-json-test , containers >=0.5.7.1 && <0.9 , dlist >=0.8.0.3 && <2 , hashable >=1.2.6.1 && <1.6 - , quickcheck-instances >=0.3.16 && <0.4 + , quickcheck-instances >=0.3.16 && <0.5 , safe-json , scientific >=0.3.5.2 && <0.4 , tasty @@ -113,7 +113,7 @@ test-suite safe-json-test , tasty-quickcheck , temporary >=1.2.1.1 , text >=1.2.3 && <2.2 - , time >=1.6.0.1 && <1.15 + , time >=1.6.0.1 && <1.16 , unordered-containers >=0.2.9 && <0.3 , uuid >=1.3.13 , uuid-types >=1.0.3 && <1.1 diff --git a/stack.yaml b/stack.yaml index de36523..0ef4426 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-22.28 +resolver: lts-24.27 # User packages to be built. # Various formats can be used as shown in the example below. diff --git a/test/Instances.hs b/test/Instances.hs index 3e06635..f353607 100644 --- a/test/Instances.hs +++ b/test/Instances.hs @@ -13,13 +13,30 @@ import Data.Aeson import qualified Data.Aeson.Key as K import qualified Data.Aeson.KeyMap as KM #endif -import Data.DList (DList, fromList, toList) +import Data.DList as DList (DList, fromList, toList) import Data.Int (Int64) +#if MIN_VERSION_quickcheck_instances(0,4,0) +import Data.List.NonEmpty as NonEmpty (NonEmpty, fromList, toList) +import Data.Semigroup as Semigroup (First (..), Last (..), Max (..), Min (..)) +#endif import Data.Time (NominalDiffTime) import Data.Time.Clock.POSIX (posixSecondsToUTCTime) import qualified Data.Vector.Primitive as VP +#if MIN_VERSION_quickcheck_instances(0,4,0) +import Numeric.Natural (Natural) +#endif -import Test.Tasty.QuickCheck (Arbitrary(..)) +import Test.Tasty.QuickCheck ( + Arbitrary (..), +#if MIN_VERSION_quickcheck_instances(0,4,0) + Arbitrary1 (..), + arbitrary1, + arbitrarySizedNatural, + listOf1, + shrink1, + shrinkIntegral, +#endif + ) #if !MIN_VERSION_aeson(2,0,3) import Test.Tasty.QuickCheck (oneof, resize) import Test.QuickCheck.Arbitrary.Generic (genericShrink) @@ -38,8 +55,8 @@ instance Arbitrary DotNetTime where shrink = fmap DotNetTime . shrink . fromDotNetTime instance Arbitrary a => Arbitrary (DList a) where - arbitrary = fromList <$> arbitrary - shrink = fmap fromList . shrink . toList + arbitrary = DList.fromList <$> arbitrary + shrink = fmap DList.fromList . shrink . DList.toList #if !MIN_VERSION_quickcheck_instances(0,3,32) instance (Arbitrary a, VP.Prim a) => Arbitrary (VP.Vector a) where @@ -89,3 +106,33 @@ instance Ord Value where Array{} `compare` Object{} = LT _ `compare` _ = GT #endif + +#if MIN_VERSION_quickcheck_instances(0,4,0) +instance Arbitrary1 NonEmpty where + liftArbitrary arb = NonEmpty.fromList <$> listOf1 arb + liftShrink shr xs = [ NonEmpty.fromList xs' | xs' <- liftShrink shr (NonEmpty.toList xs), not (null xs') ] + +instance Arbitrary a => Arbitrary (NonEmpty a) where + arbitrary = arbitrary1 + shrink = shrink1 + +instance Arbitrary a => Arbitrary (Semigroup.Min a) where + arbitrary = fmap Semigroup.Min arbitrary + shrink = map Semigroup.Min . shrink . Semigroup.getMin + +instance Arbitrary a => Arbitrary (Semigroup.Max a) where + arbitrary = fmap Semigroup.Max arbitrary + shrink = map Semigroup.Max . shrink . Semigroup.getMax + +instance Arbitrary a => Arbitrary (Semigroup.First a) where + arbitrary = fmap Semigroup.First arbitrary + shrink = map Semigroup.First . shrink . Semigroup.getFirst + +instance Arbitrary a => Arbitrary (Semigroup.Last a) where + arbitrary = fmap Semigroup.Last arbitrary + shrink = map Semigroup.Last . shrink . Semigroup.getLast + +instance Arbitrary Natural where + arbitrary = arbitrarySizedNatural + shrink = shrinkIntegral +#endif diff --git a/test/PrimitiveTests.hs b/test/PrimitiveTests.hs index 0c47796..f4f6966 100644 --- a/test/PrimitiveTests.hs +++ b/test/PrimitiveTests.hs @@ -4,7 +4,6 @@ {-# LANGUAGE TypeApplications #-} module PrimitiveTests where - import Control.Applicative (Const) import Data.Aeson (DotNetTime, Value, (.:)) import qualified Data.Aeson as A