Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ 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:
- ubuntu-latest
- 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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions safe-json.cabal
Original file line number Diff line number Diff line change
@@ -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.
.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -105,15 +105,15 @@ 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
, tasty-hunit
, 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
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
55 changes: 51 additions & 4 deletions test/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion test/PrimitiveTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{-# LANGUAGE TypeApplications #-}
module PrimitiveTests where


import Control.Applicative (Const)
import Data.Aeson (DotNetTime, Value, (.:))
import qualified Data.Aeson as A
Expand Down
Loading