packages feed

yaya-hedgehog 0.1.2.1 → 0.2.0.0

raw patch · 4 files changed

+32/−23 lines, 4 filesdep ~yaya

Dependency ranges changed: yaya

Files

CHANGELOG.md view
@@ -4,6 +4,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/). +## 0.2.0.0 – 2020–05–14+### Changed+- updated in sync with polykinding changes in yaya-0.3.0.0++## 0.1.2.2 – 2020–05–14+### Changed+- enabled and fixed warnings+ ## 0.1.2.1 – 2019–11–08 ### Changed - improved documentation
src/Yaya/Hedgehog/Expr.hs view
@@ -32,7 +32,7 @@ genExpr :: Gen a -> Gen (Expr a) genExpr a = Gen.frequency [(3, genExprLit), (2, genExprOp a)] -expression :: Steppable t Expr => Size -> Gen t+expression :: Steppable (->) t Expr => Size -> Gen t expression = embeddableOfHeight genExprLit genExpr  genMuExpr :: Size -> Gen (Mu Expr)
src/Yaya/Hedgehog/Fold.hs view
@@ -11,43 +11,43 @@ import           Numeric.Natural  import           Yaya.Fold-import           Yaya.Fold.Native+import           Yaya.Fold.Native ()  law_cataCancel-  :: (Eq a, Show a, Steppable t f, Recursive t f, Functor f, MonadTest m)-  => Algebra f a -> f t -> m ()+  :: (Eq a, Show a, Steppable (->) t f, Recursive (->) t f, Functor f, MonadTest m)+  => Algebra (->) f a -> f t -> m () law_cataCancel φ = uncurry (===) . (cata φ . embed &&& φ . fmap (cata φ))  law_cataRefl-  :: (Eq t, Show t, Steppable t f, Recursive t f, MonadTest m) => t -> m ()+  :: (Eq t, Show t, Steppable (->) t f, Recursive (->) t f, MonadTest m) => t -> m () law_cataRefl = uncurry (===) . (cata embed &&& id)  -- | NB: Since this requires both a `Corecursive` and `Eq` instance on the same --       type, it _likely_ requires instances from yaya-unsafe. law_anaRefl-  :: (Eq t, Show t, Steppable t f, Corecursive t f, MonadTest m) => t -> m ()+  :: (Eq t, Show t, Steppable (->) t f, Corecursive (->) t f, MonadTest m) => t -> m () law_anaRefl = uncurry (===) . (ana project &&& id)  -- law_cataFusion---   :: (Eq a, Show a, Recursive t f, Functor f, MonadTest m)---   => (a -> a) -> Algebra f a -> f a -> t -> m ()+--   :: (Eq a, Show a, Recursive (->) t f, Functor f, MonadTest m)+--   => (a -> a) -> Algebra (->) f a -> f a -> t -> m () -- law_cataFusion f φ fa t = --       uncurry (==) ((f . φ &&& φ . fmap f) fa) --   ==> uncurry (===) ((f . cata φ &&& cata φ) t)  law_cataCompose   :: forall t f u g m b-   . (Eq b, Show b, Recursive t f, Steppable u g, Recursive u g, MonadTest m)-  => Proxy u -> Algebra g b -> (forall a. f a -> g a) -> t -> m ()+   . (Eq b, Show b, Recursive (->) t f, Steppable (->) u g, Recursive (->) u g, MonadTest m)+  => Proxy u -> Algebra (->) g b -> (forall a. f a -> g a) -> t -> m () law_cataCompose _ φ ε =   uncurry (===) . (cata φ . cata (embed . ε :: f u -> u) &&& cata (φ . ε))  -- | Creates a generator for any `Steppable` type whose pattern functor has --   terminal cases (e.g., not `Data.Functor.Identity` or `((,) a)`). @leaf@ can---   only generate terminal cases, and `any` can generate any case. If the---   provided `any` generates terminal cases, then the resulting tree may have a---   height less than the `Size`, otherwise it will be a perfect tree with a---   height of exactly the provided `Size`.+--   only generate terminal cases, and `branch` can generate any case. If the+--   provided `branch` generates terminal cases, then the resulting tree may+--   have a height less than the `Size`, otherwise it will be a perfect tree+--   with a height of exactly the provided `Size`. -- --   This is similar to `Gen.recursive` in that it separates the non-recursive --   cases from the recursive ones, except@@ -66,17 +66,18 @@ --  NB: Hedgehog’s `Size` is signed, so this can raise an exception if given a --      negative `Size`. embeddableOfHeight-  :: (Steppable t f, Functor f)+  :: (Steppable (->) t f, Functor f)   => Gen (f Void) -> (Gen t -> Gen (f t)) -> Size -> Gen t-embeddableOfHeight leaf any size =-  cata (genAlgebra leaf any) (fromIntegral size :: Natural)+embeddableOfHeight leaf branch size =+  cata (genAlgebra leaf branch) (fromIntegral size :: Natural)  -- | Builds a generic tree generator of a certain height. genAlgebra-  :: (Steppable t f, Functor f)-  => Gen (f Void) -> (Gen t -> Gen (f t)) -> Algebra Maybe (Gen t)-genAlgebra leaf any = maybe (fmap (embed . fmap absurd) leaf) (fmap embed . any)+  :: (Steppable (->) t f, Functor f)+  => Gen (f Void) -> (Gen t -> Gen (f t)) -> Algebra (->) Maybe (Gen t)+genAlgebra leaf branch =+  maybe (fmap (embed . fmap absurd) leaf) (fmap embed . branch)  -- | Creates a generator for potentially-infinite values.-genCorecursive :: Corecursive t f => (a -> f a) -> Gen a -> Gen t+genCorecursive :: Corecursive (->) t f => (a -> f a) -> Gen a -> Gen t genCorecursive = fmap . ana
yaya-hedgehog.cabal view
@@ -1,5 +1,5 @@ name:                yaya-hedgehog-version:             0.1.2.1+version:             0.2.0.0 synopsis:            Hedgehog testing support for the Yaya recursion scheme                      library. description:         If you use Yaya in your own code and have tests written@@ -24,7 +24,7 @@   build-depends:       base >= 4.7 && < 5                      , deriving-compat                      , hedgehog-                     , yaya >= 0.1.0+                     , yaya >= 0.3.0   default-extensions:  ConstraintKinds                      , DeriveTraversable                      , FlexibleContexts