registry 0.6.0.0 → 0.6.1.0
raw patch · 4 files changed
+17/−14 lines, 4 filesdep ~MonadRandomdep ~tasty-discoverdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: MonadRandom, tasty-discover, text
API changes (from Hackage documentation)
Files
- registry.cabal +7/−7
- src/Data/Registry/Lift.hs +1/−0
- test/Test/Data/Registry/GenSpec.hs +8/−7
- test/test.hs +1/−0
registry.cabal view
@@ -1,13 +1,13 @@ 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: 58716f09f121c810611a3d1fcee02e0347cc257f2e77c051d7990b4367e346f4 name: registry-version: 0.6.0.0+version: 0.6.1.0 synopsis: data structure for assembling components description: This library provides a "Registry" which is a data structure containing a list of functions and values representing dependencies in a directed acyclic graph. A `make` function can then be used to create a value of a specific type out of the registry. You can start with the [README](https://github.com/etorreborre/registry/blob/master/README.md) for a full description of the library.@@ -75,7 +75,7 @@ , 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 @@ 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 @@ , 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
src/Data/Registry/Lift.hs view
@@ -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
test/Test/Data/Registry/GenSpec.hs view
@@ -12,7 +12,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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
test/test.hs view
@@ -2,4 +2,5 @@ import Protolude import Test.Tasty.Extensions +main :: IO () main = tests >>= defaultMain . groupByModuleName