packages feed

hedgehog-fn 0.6 → 1.0

raw patch · 4 files changed

+19/−16 lines, 4 filesdep ~basedep ~hedgehogdep ~transformerssetup-changedPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, hedgehog, transformers

API changes (from Hackage documentation)

- Hedgehog.Function.Internal: instance Hedgehog.Function.Internal.Arg a => Hedgehog.Function.Internal.Arg (GHC.Base.Maybe a)
- Hedgehog.Function.Internal: instance Hedgehog.Function.Internal.Vary a => Hedgehog.Function.Internal.Vary (GHC.Base.Maybe a)
+ Hedgehog.Function.Internal: infixr 5 :->
+ Hedgehog.Function.Internal: instance Hedgehog.Function.Internal.Arg a => Hedgehog.Function.Internal.Arg (GHC.Maybe.Maybe a)
+ Hedgehog.Function.Internal: instance Hedgehog.Function.Internal.Vary a => Hedgehog.Function.Internal.Vary (GHC.Maybe.Maybe a)
- Hedgehog.Function: buildIntegral :: (Arg a, Integral a) => (a -> c) -> (a :-> c)
+ Hedgehog.Function: buildIntegral :: (Arg a, Integral a) => (a -> c) -> a :-> c
- Hedgehog.Function.Internal: CoGenT :: forall b. a -> GenT m b -> GenT m b -> CoGenT m a
+ Hedgehog.Function.Internal: CoGenT :: (forall b. a -> GenT m b -> GenT m b) -> CoGenT m a
- Hedgehog.Function.Internal: Fn :: b -> (a :-> Tree (MaybeT Identity) b) -> Fn a b
+ Hedgehog.Function.Internal: Fn :: b -> (a :-> TreeT (MaybeT Identity) b) -> Fn a b
- Hedgehog.Function.Internal: [Map] :: (a -> b) -> (b -> a) -> b :-> c -> a :-> c
+ Hedgehog.Function.Internal: [Map] :: (a -> b) -> (b -> a) -> (b :-> c) -> a :-> c
- Hedgehog.Function.Internal: [Pair] :: a :-> b :-> c -> (a, b) :-> c
+ Hedgehog.Function.Internal: [Pair] :: (a :-> (b :-> c)) -> (a, b) :-> c
- Hedgehog.Function.Internal: [Sum] :: a :-> c -> b :-> c -> Either a b :-> c
+ Hedgehog.Function.Internal: [Sum] :: (a :-> c) -> (b :-> c) -> Either a b :-> c
- Hedgehog.Function.Internal: apply' :: a :-> b -> a -> Maybe b
+ Hedgehog.Function.Internal: apply' :: (a :-> b) -> a -> Maybe b
- Hedgehog.Function.Internal: buildIntegral :: (Arg a, Integral a) => (a -> c) -> (a :-> c)
+ Hedgehog.Function.Internal: buildIntegral :: (Arg a, Integral a) => (a -> c) -> a :-> c
- Hedgehog.Function.Internal: data a (:->) c
+ Hedgehog.Function.Internal: data a :-> c
- Hedgehog.Function.Internal: shrinkFn :: (b -> [b]) -> a :-> b -> [a :-> b]
+ Hedgehog.Function.Internal: shrinkFn :: (b -> [b]) -> (a :-> b) -> [a :-> b]
- Hedgehog.Function.Internal: shrinkTree :: Monad m => Tree (MaybeT m) a -> m [Tree (MaybeT m) a]
+ Hedgehog.Function.Internal: shrinkTree :: Monad m => TreeT (MaybeT m) a -> m [TreeT (MaybeT m) a]
- Hedgehog.Function.Internal: table :: a :-> c -> [(a, c)]
+ Hedgehog.Function.Internal: table :: (a :-> c) -> [(a, c)]
- Hedgehog.Function.Internal: unsafeApply :: a :-> b -> a -> b
+ Hedgehog.Function.Internal: unsafeApply :: (a :-> b) -> a -> b
- Hedgehog.Function.Internal: unsafeFromTree :: Functor m => Tree (MaybeT m) a -> m a
+ Hedgehog.Function.Internal: unsafeFromTree :: Functor m => TreeT (MaybeT m) a -> m a

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+1.0 - 2019-05-17++* Drop support for GHC < 8+* Upgrade to hedgehog-1.0+ 0.6  * hedgehog-0.6 compatibility
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
hedgehog-fn.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/  name:                hedgehog-fn-version:             0.6+version:             1.0 synopsis:            Function generation for `hedgehog` description:         Generating shrinkable, showable functions with `hedgehog`. See                      `Hedgehog.Function` for example usages.@@ -17,7 +17,7 @@ build-type:          Simple cabal-version:       >=1.10 extra-source-files:  ChangeLog.md-tested-with:         GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3+tested-with:         GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5  source-repository    head   type:              git@@ -32,7 +32,7 @@                      , Hedgehog.Function.Internal   build-depends:       base >=4.8 && <5                      , contravariant >=1.4 && <1.6-                     , hedgehog >=0.6 && <0.7+                     , hedgehog >=1.0 && <1.1                      , transformers >=0.5 && <0.6   hs-source-dirs:      src   default-language:    Haskell2010@@ -45,6 +45,6 @@     buildable:         False   hs-source-dirs:      example   build-depends:       base >=4.8 && <5-                     , hedgehog >=0.5 && <0.7+                     , hedgehog >=1.0 && <1.1                      , hedgehog-fn   default-language:    Haskell2010
src/Hedgehog/Function/Internal.hs view
@@ -16,7 +16,7 @@ import Data.Word (Word8, Word64) import Hedgehog.Internal.Gen (GenT(..), Gen, runGenT) import Hedgehog.Internal.Seed (Seed(..))-import Hedgehog.Internal.Tree (Tree(..), Node(..))+import Hedgehog.Internal.Tree (TreeT(..), NodeT(..)) import Hedgehog.Internal.Property (PropertyT, forAll)  import GHC.Generics@@ -169,14 +169,14 @@ unsafeApply f = fromJust . apply' f  -- | The type of randomly-generated functions-data Fn a b = Fn b (a :-> Tree (MaybeT Identity) b)+data Fn a b = Fn b (a :-> TreeT (MaybeT Identity) b) --- | Extract the root value from a 'Tree'. Unsafe.-unsafeFromTree :: Functor m => Tree (MaybeT m) a -> m a+-- | Extract the root value from a 'TreeT'. Unsafe.+unsafeFromTree :: Functor m => TreeT (MaybeT m) a -> m a unsafeFromTree =   fmap (maybe (error "empty generator in function") nodeValue) .   runMaybeT .-  runTree+  runTreeT  instance (Show a, Show b) => Show (Fn a b) where   show (Fn b a) =@@ -184,7 +184,7 @@       [] -> "_ -> " ++ show b       ta -> showTable ta ++ "_ -> " ++ show b     where-      showTable :: (Show a, Show b) => [(a, Tree (MaybeT Identity) b)] -> String+      showTable :: (Show a, Show b) => [(a, TreeT (MaybeT Identity) b)] -> String       showTable [] = "<empty function>\n"       showTable (x : xs) = unlines (showCase <$> x : xs)         where@@ -207,12 +207,12 @@     notNil _ = True shrinkFn shr (Map f g a) = (\case; Nil -> Nil; x -> Map f g x) <$> shrinkFn shr a -shrinkTree :: Monad m => Tree (MaybeT m) a -> m [Tree (MaybeT m) a]-shrinkTree (Tree m) = do+shrinkTree :: Monad m => TreeT (MaybeT m) a -> m [TreeT (MaybeT m) a]+shrinkTree (Tree.TreeT m) = do   a <- runMaybeT m   case a of     Nothing -> pure []-    Just (Node _ cs) -> pure cs+    Just (Tree.NodeT _ cs) -> pure cs  -- | Evaluate an 'Fn' apply :: Fn a b -> a -> b@@ -225,7 +225,7 @@   gb <*>   genFn (\a -> applyCoGenT cg a gb)   where-    genFn :: Arg a => (a -> Gen b) -> Gen (a :-> Tree (MaybeT Identity) b)+    genFn :: Arg a => (a -> Gen b) -> Gen (a :-> TreeT (MaybeT Identity) b)     genFn g =       GenT $ \sz sd ->       Tree.unfold (shrinkFn $ runIdentity . shrinkTree) .