diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 027a12b..3508233 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - stack: ["2.7.3"] + stack: ["2.9.1"] ghc: - "8.10.7" - "9.0.2" - - "9.2.2" + - "9.2.8" + - "9.4.8" + - "9.6.3" steps: - uses: actions/checkout@v2 diff --git a/package.yaml b/package.yaml index dabf716..3920e89 100644 --- a/package.yaml +++ b/package.yaml @@ -57,7 +57,7 @@ dependencies: - semigroupoids >= 5.0 && < 5.4 - semigroups >= 0.15 && < 0.30 - template-haskell >= 2.13 && < 3.0 - - text >= 1.1 && < 2 + - text >= 1.1 && < 3 - transformers-base >= 0.4 && < 0.5 - unliftio >= 0.2 && < 1 @@ -80,15 +80,15 @@ tests: - hedgehog >= 1.0 && < 3.0 - generic-lens >= 1.0 && < 3.0 - io-memoize < 1.2 - - MonadRandom < 0.6 + - MonadRandom < 1 - multimap < 2 - semigroups < 0.30 - random < 2.0 - tasty < 1.5 - - tasty-discover < 4.3 + - tasty-discover < 6 - tasty-hedgehog >= 1.2 && < 2.0 - tasty-th < 0.2 - - text < 2 + - text < 3 - universum < 2 ghc-options: diff --git a/registry.cabal b/registry.cabal index 6f308ab..a68076b 100644 --- a/registry.cabal +++ b/registry.cabal @@ -1,10 +1,10 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack -- --- hash: eba4b73d85a7c3fbee86501abdf3870e4af595503b7879280fad3c2baecbb4c1 +-- hash: 62a78d871e414b366ac28e6f56ac9f60559a7efc9b6165b3d0c3e3087a7a21b1 name: registry version: 0.6.0.0 @@ -75,7 +75,7 @@ library , semigroupoids >=5.0 && <5.4 , semigroups >=0.15 && <0.30 , template-haskell >=2.13 && <3.0 - , text >=1.1 && <2 + , text >=1.1 && <3 , transformers-base ==0.4.* , unliftio >=0.2 && <1 default-language: GHC2021 @@ -131,7 +131,7 @@ test-suite spec TypeFamilyDependencies ghc-options: -Wall -Wcompat -Wincomplete-record-updates -fhide-source-paths -fprint-potential-instances -optP-Wno-nonportable-include-path -threaded -rtsopts -with-rtsopts=-N -fno-warn-orphans -fno-warn-missing-signatures -fno-warn-incomplete-uni-patterns -optP-Wno-nonportable-include-path build-depends: - MonadRandom <0.6 + MonadRandom <1 , async <2.3 , base >=4.14 && <5 , bytestring <0.12 @@ -152,11 +152,11 @@ test-suite spec , semigroupoids >=5.0 && <5.4 , semigroups <0.30 , tasty <1.5 - , tasty-discover <4.3 + , tasty-discover <6 , tasty-hedgehog >=1.2 && <2.0 , tasty-th <0.2 , template-haskell >=2.13 && <3.0 - , text <2 + , text <3 , transformers-base ==0.4.* , universum <2 , unliftio >=0.2 && <1 diff --git a/src/Data/Registry/Lift.hs b/src/Data/Registry/Lift.hs index e392bc5..5b148b4 100644 --- a/src/Data/Registry/Lift.hs +++ b/src/Data/Registry/Lift.hs @@ -19,6 +19,7 @@ module Data.Registry.Lift where import Protolude hiding (Nat) +import Data.Type.Equality -- | Typeclass for lifting pure functions to effectful arguments and results class Applicative f => ApplyVariadic f a b where diff --git a/stack.yaml b/stack.yaml index 0a3905d..9f4dc35 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,10 +1,8 @@ -resolver: lts-20.1 +resolver: lts-21.22 packages: - '.' -extra-deps: - flags: {} extra-package-dbs: [] diff --git a/stack.yaml.lock b/stack.yaml.lock index e067f78..e8d3cc7 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -6,7 +6,7 @@ packages: [] snapshots: - completed: - sha256: b73b2b116143aea728c70e65c3239188998bac5bc3be56465813dacd74215dc5 - size: 648424 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/1.yaml - original: lts-20.1 + sha256: afd5ba64ab602cabc2d3942d3d7e7dd6311bc626dcb415b901eaf576cb62f0ea + size: 640060 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/22.yaml + original: lts-21.22 diff --git a/test/Test/Data/Registry/GenSpec.hs b/test/Test/Data/Registry/GenSpec.hs index b63af0d..58c5164 100644 --- a/test/Test/Data/Registry/GenSpec.hs +++ b/test/Test/Data/Registry/GenSpec.hs @@ -12,7 +12,8 @@ import Data.Registry import Hedgehog.Gen as Gen import Hedgehog.Range as Range import Protolude as P -import Test.Tasty.Extensions +import Test.Tasty.Extensions hiding (forAll) +import Test.Tasty.Extensions qualified as Tasty -- * DATA MODEL @@ -57,12 +58,12 @@ genDouble = Gen.double (Range.linearFrac 1 100) setDepartmentWithOneEmployee :: Monad m => RegistryProperty m () setDepartmentWithOneEmployee = do - e <- forall @Employee + e <- forAll @Employee tweakGen @[Employee] (const $ pure [e]) setCompanyWithOneDepartment :: Monad m => RegistryProperty m () setCompanyWithOneDepartment = do - d <- forall @Department + d <- forAll @Department tweakGen @[Department] (const (pure [d])) setMinimalCompany :: Monad m => RegistryProperty m () @@ -91,7 +92,7 @@ test_company_with_one_employee = noShrink $ prop "generate just one employee" $ runR $ do setMinimalCompany - company <- forall @Company + company <- forAll @Company let allEmployees = company & departments >>= (& employees) length allEmployees === 1 @@ -110,7 +111,7 @@ salaryGen fixed variable = choice [unTag <$> fixed, unTag <$> variable] test_with_different_salaries = noShrink $ prop "generate both fixed and variable salaries" $ runWith registry' $ do - salaries <- forall @[Salary] + salaries <- forAll @[Salary] let (fixed, variables) = partition isFixed salaries annotate "the choice operator allows us to generate both fixed and variable salaries" @@ -121,8 +122,8 @@ test_with_different_salaries = noShrink $ type RegistryProperty m a = forall ins out. StateT (Registry ins out) (PropertyT m) a -forall :: forall a m. (HasCallStack, Typeable a, Show a, Monad m) => RegistryProperty m a -forall = withFrozenCallStack $ get >>= P.lift . forAll . make @(Gen a) +forAll :: forall a m. (HasCallStack, Typeable a, Show a, Monad m) => RegistryProperty m a +forAll = withFrozenCallStack $ get >>= P.lift . Tasty.forAll . make @(Gen a) tweakGen :: forall a m. (Typeable a, Monad m) => (Gen a -> Gen a) -> RegistryProperty m () tweakGen f = modify $ tweak @(Gen a) f diff --git a/test/test.hs b/test/test.hs index 38cb8d3..9a44ef7 100644 --- a/test/test.hs +++ b/test/test.hs @@ -2,4 +2,5 @@ import AutoDiscoveredSpecs (tests) import Protolude import Test.Tasty.Extensions +main :: IO () main = tests >>= defaultMain . groupByModuleName