registry-hedgehog 0.4.1.0 → 0.5.0.0
raw patch · 2 files changed
+23/−13 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Registry.Hedgehog: tuple4Of :: forall a b c d. GenIO a -> GenIO b -> GenIO c -> GenIO d -> GenIO (a, b, c, d)
+ Data.Registry.Hedgehog: tuple5Of :: forall a b c d e. GenIO a -> GenIO b -> GenIO c -> GenIO d -> GenIO e -> GenIO (a, b, c, d, e)
+ Test.Tasty.Hedgehogx: Rec :: K1 R a x -> Rec p a (x :: k)
+ Test.Tasty.Hedgehogx: [unRec] :: Rec p a (x :: k) -> K1 R a x
+ Test.Tasty.Hedgehogx: bmap :: FunctorB b => (forall (a :: k). () => f a -> g a) -> b f -> b g
+ Test.Tasty.Hedgehogx: btraverse :: (TraversableB b, Applicative e) => (forall (a :: k). () => f a -> e (g a)) -> b f -> e (b g)
+ Test.Tasty.Hedgehogx: class FunctorB (b :: k -> Type -> Type)
+ Test.Tasty.Hedgehogx: class FunctorB b => TraversableB (b :: k -> Type -> Type)
+ Test.Tasty.Hedgehogx: newtype Rec p a (x :: k)
- Data.Registry.Hedgehog: setCycleChooser :: forall a ins out. (Typeable a, Contains (GenIO a) out) => Registry ins out -> Registry ins out
+ Data.Registry.Hedgehog: setCycleChooser :: forall a ins out. Typeable a => Registry ins out -> Registry ins out
- Data.Registry.Hedgehog: setCycleChooserS :: forall a m ins out. (Typeable a, Contains (GenIO a) out, MonadState (Registry ins out) m, MonadIO m) => m ()
+ Data.Registry.Hedgehog: setCycleChooserS :: forall a m ins out. (Typeable a, MonadState (Registry ins out) m, MonadIO m) => m ()
- Data.Registry.Hedgehog: setDistinct :: forall a ins out. (Eq a, Typeable a, Contains (GenIO a) out) => Registry ins out -> Registry ins out
+ Data.Registry.Hedgehog: setDistinct :: forall a ins out. (Eq a, Typeable a) => Registry ins out -> Registry ins out
- Data.Registry.Hedgehog: setDistinctFor :: forall a b ins out. (Typeable a, Contains (GenIO a) out, Eq b, Typeable b, Contains (GenIO b) out) => Registry ins out -> Registry ins out
+ Data.Registry.Hedgehog: setDistinctFor :: forall a b ins out. (Typeable a, Eq b, Typeable b) => Registry ins out -> Registry ins out
- Data.Registry.Hedgehog: setDistinctForS :: forall a b m ins out. (Typeable a, Contains (GenIO a) out, Eq b, Typeable b, Contains (GenIO b) out, MonadState (Registry ins out) m, MonadIO m) => m ()
+ Data.Registry.Hedgehog: setDistinctForS :: forall a b m ins out. (Typeable a, Eq b, Typeable b, MonadState (Registry ins out) m, MonadIO m) => m ()
- Data.Registry.Hedgehog: setDistinctS :: forall a m ins out. (Eq a, Typeable a, Contains (GenIO a) out, MonadState (Registry ins out) m, MonadIO m) => m ()
+ Data.Registry.Hedgehog: setDistinctS :: forall a m ins out. (Eq a, Typeable a, MonadState (Registry ins out) m, MonadIO m) => m ()
- Data.Registry.Hedgehog: specializeGen :: forall a b ins out. (Typeable a, Typeable b, Contains (GenIO a) out) => Gen b -> Registry ins out -> Registry ins out
+ Data.Registry.Hedgehog: specializeGen :: forall a b ins out. (Typeable a, Typeable b) => Gen b -> Registry ins out -> Registry ins out
- Data.Registry.Hedgehog: specializeGenIO :: forall a b ins out. (Typeable a, Typeable b, Contains (GenIO a) out) => GenIO b -> Registry ins out -> Registry ins out
+ Data.Registry.Hedgehog: specializeGenIO :: forall a b ins out. (Typeable a, Typeable b) => GenIO b -> Registry ins out -> Registry ins out
- Data.Registry.Hedgehog: specializeGenS :: forall a b m ins out. (Typeable a, Typeable b, Contains (GenIO a) out, MonadState (Registry ins out) m) => Gen b -> m ()
+ Data.Registry.Hedgehog: specializeGenS :: forall a b m ins out. (Typeable a, Typeable b, MonadState (Registry ins out) m) => Gen b -> m ()
Files
- registry-hedgehog.cabal +2/−2
- src/Data/Registry/Hedgehog.hs +21/−11
registry-hedgehog.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: c5a3413b29d2e5af445725863ab1c5a4bdcb5654a60020e7c5f04d424e3ebb72+-- hash: 8df9d1fe1e960d1a38f39a81e36d27257cfaf4c32fc4907122da8842b84271a5 name: registry-hedgehog-version: 0.4.1.0+version: 0.5.0.0 synopsis: utilities to work with Hedgehog generators and `registry` description: This library provides some functions to extract generators from a "Registry" and make stateful modifications of that Registry to precisely control the generation of data category: Control
src/Data/Registry/Hedgehog.hs view
@@ -36,6 +36,8 @@ pairOf, setOf, tripleOf,+ tuple4Of,+ tuple5Of, -- cycling values choiceChooser, chooseOne,@@ -104,15 +106,15 @@ setGenS genA = modify (setGen genA) -- | Specialize a generator in a given context-specializeGen :: forall a b ins out. (Typeable a, Typeable b, Contains (GenIO a) out) => Gen b -> Registry ins out -> Registry ins out+specializeGen :: forall a b ins out. (Typeable a, Typeable b) => Gen b -> Registry ins out -> Registry ins out specializeGen g = specializeGenIO @a (liftGen g) -- | Specialize a generator in a given context-specializeGenIO :: forall a b ins out. (Typeable a, Typeable b, Contains (GenIO a) out) => GenIO b -> Registry ins out -> Registry ins out+specializeGenIO :: forall a b ins out. (Typeable a, Typeable b) => GenIO b -> Registry ins out -> Registry ins out specializeGenIO = specialize @(GenIO a) -- | Specialize a generator in a given context-specializeGenS :: forall a b m ins out. (Typeable a, Typeable b, Contains (GenIO a) out, MonadState (Registry ins out) m) => Gen b -> m ()+specializeGenS :: forall a b m ins out. (Typeable a, Typeable b, MonadState (Registry ins out) m) => Gen b -> m () specializeGenS g = modify (specializeGen @a @b g) -- | Modify a generator@@ -152,6 +154,14 @@ tripleOf :: forall a b c. GenIO a -> GenIO b -> GenIO c -> GenIO (a, b, c) tripleOf ga gb gc = (,,) <$> ga <*> gb <*> gc +-- | Create a generator for a quadruple+tuple4Of :: forall a b c d. GenIO a -> GenIO b -> GenIO c -> GenIO d -> GenIO (a, b, c, d)+tuple4Of ga gb gc gd = (,,,) <$> ga <*> gb <*> gc <*> gd++-- | Create a generator for a quintuple+tuple5Of :: forall a b c d e. GenIO a -> GenIO b -> GenIO c -> GenIO d -> GenIO e -> GenIO (a, b, c, d, e)+tuple5Of ga gb gc gd ge = (,,,,) <$> ga <*> gb <*> gc <*> gd <*> ge+ -- | Create a default generator for a small list of elements listOf :: forall a. GenIO a -> GenIO [a] listOf = Gen.list (linear 0 10)@@ -197,14 +207,14 @@ -- | Set a cycling chooser for a specific data type {-# NOINLINE setCycleChooser #-}-setCycleChooser :: forall a ins out. (Typeable a, Contains (GenIO a) out) => Registry ins out -> Registry ins out+setCycleChooser :: forall a ins out. (Typeable a) => Registry ins out -> Registry ins out setCycleChooser r = unsafePerformIO $ do c <- cycleChooser pure $ specializeValTo @GenIO @(GenIO a) c r -- | Set a cycling chooser for a specific data type {-# NOINLINE setCycleChooserS #-}-setCycleChooserS :: forall a m ins out. (Typeable a, Contains (GenIO a) out, MonadState (Registry ins out) m, MonadIO m) => m ()+setCycleChooserS :: forall a m ins out. (Typeable a, MonadState (Registry ins out) m, MonadIO m) => m () setCycleChooserS = let c = unsafePerformIO cycleChooser in do@@ -216,30 +226,30 @@ -- | Generate distinct values for a specific data type {-# NOINLINE setDistinct #-}-setDistinct :: forall a ins out. (Eq a, Typeable a, Contains (GenIO a) out) => Registry ins out -> Registry ins out+setDistinct :: forall a ins out. (Eq a, Typeable a) => Registry ins out -> Registry ins out setDistinct = setDistinctWithRef @a (unsafePerformIO $ newIORef []) -setDistinctWithRef :: forall a ins out. (Eq a, Typeable a, Contains (GenIO a) out) => IORef [a] -> Registry ins out -> Registry ins out+setDistinctWithRef :: forall a ins out. (Eq a, Typeable a) => IORef [a] -> Registry ins out -> Registry ins out setDistinctWithRef ref r = setGenIO (distinctWith ref (make @(GenIO a) r)) r -- | Generate distinct values for a specific data type {-# NOINLINE setDistinctS #-}-setDistinctS :: forall a m ins out. (Eq a, Typeable a, Contains (GenIO a) out, MonadState (Registry ins out) m, MonadIO m) => m ()+setDistinctS :: forall a m ins out. (Eq a, Typeable a, MonadState (Registry ins out) m, MonadIO m) => m () setDistinctS = let ref = unsafePerformIO $ newIORef [] in modify (setDistinctWithRef @a ref) -- | Generate distinct values for a specific data type, when used inside another data type {-# NOINLINE setDistinctFor #-}-setDistinctFor :: forall a b ins out. (Typeable a, Contains (GenIO a) out, Eq b, Typeable b, Contains (GenIO b) out) => Registry ins out -> Registry ins out+setDistinctFor :: forall a b ins out. (Typeable a, Eq b, Typeable b) => Registry ins out -> Registry ins out setDistinctFor = setDistinctForWithRef @a @b (unsafePerformIO $ newIORef []) -setDistinctForWithRef :: forall a b ins out. (Typeable a, Contains (GenIO a) out, Eq b, Typeable b, Contains (GenIO b) out) => IORef [b] -> Registry ins out -> Registry ins out+setDistinctForWithRef :: forall a b ins out. (Typeable a, Eq b, Typeable b) => IORef [b] -> Registry ins out -> Registry ins out setDistinctForWithRef ref r = specializeGenIO @a (distinctWith ref (make @(GenIO b) r)) r -- | Generate distinct values for a specific data type, when used inside another data type {-# NOINLINE setDistinctForS #-}-setDistinctForS :: forall a b m ins out. (Typeable a, Contains (GenIO a) out, Eq b, Typeable b, Contains (GenIO b) out, MonadState (Registry ins out) m, MonadIO m) => m ()+setDistinctForS :: forall a b m ins out. (Typeable a, Eq b, Typeable b, MonadState (Registry ins out) m, MonadIO m) => m () setDistinctForS = let ref = unsafePerformIO $ newIORef [] in modify (setDistinctForWithRef @a @b ref)