yaya-hedgehog 0.1.1.0 → 0.1.2.1
raw patch · 4 files changed
+32/−23 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Yaya.Hedgehog.Fold: 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 ()
Files
- CHANGELOG.md +8/−0
- src/Yaya/Hedgehog/Expr.hs +1/−0
- src/Yaya/Hedgehog/Fold.hs +22/−22
- yaya-hedgehog.cabal +1/−1
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.1.2.1 – 2019–11–08+### Changed+- improved documentation++## 0.1.2.0 – 2019–11–08+### Added+- `law_cataCompose`+ ## 0.1.1.0 – 2019–01–08 ### Added - `law_anaRefl` as dual to `law_cataRefl`
src/Yaya/Hedgehog/Expr.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} module Yaya.Hedgehog.Expr where
src/Yaya/Hedgehog/Fold.hs view
@@ -5,6 +5,7 @@ module Yaya.Hedgehog.Fold where import Control.Arrow+import Data.Proxy import Data.Void import Hedgehog import Numeric.Natural@@ -17,11 +18,6 @@ => Algebra f a -> f t -> m () law_cataCancel φ = uncurry (===) . (cata φ . embed &&& φ . fmap (cata φ)) --- law_anaCancel--- :: (Eq (f t), Show a, Steppable t f, Corecursive t f, Functor f, MonadTest m)--- => Coalgebra f a -> a -> m ()--- law_anaCancel ψ = uncurry (===) . (project . ana ψ &&& fmap (ana ψ) . ψ)- law_cataRefl :: (Eq t, Show t, Steppable t f, Recursive t f, MonadTest m) => t -> m () law_cataRefl = uncurry (===) . (cata embed &&& id)@@ -39,32 +35,36 @@ -- uncurry (==) ((f . φ &&& φ . fmap f) fa) -- ==> uncurry (===) ((f . cata φ &&& cata φ) t) --- law_cataCompose--- :: (Eq b, Show b, Recursive t f, Steppable u g, Recursive u g, MonadTest m)--- => Algebra g b -> (forall a. f a -> g a) -> t -> m ()--- law_cataCompose φ ε =--- uncurry (===) . (cata φ . cata (embed . ε) &&& cata (φ . ε))+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 ()+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 `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`.+-- 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`. -- -- This is similar to `Gen.recursive` in that it separates the non-recursive -- cases from the recursive ones, except--- • the types here also ensure that the non-recursive cases aren’t recursive,--- • different generator distributions may be used for rec & non-rec cases, and--- • the non-recursive cases aren’t included in recursive calls (see above for+--+-- * the types here also ensure that the non-recursive cases aren’t recursive,+--+-- * different generator distributions may be used for rec & non-rec cases, and+--+-- * the non-recursive cases aren’t included in recursive calls (see above for -- why). ----- If there’s no existing `Gen (f Void)` for your pattern functor, you can+-- If there’s no existing @Gen (f Void)@ for your pattern functor, you can -- either create one manually, or pass `Hedgehog.Gen.discard` to the usual--- `Gen a -> Gen (f a)` generator.+-- @Gen a -> Gen (f a)@ generator. ----- *NB*: Hedgehog’s `Size` is signed, so this can raise an exception if given a--- negative `Size`.+-- NB: Hedgehog’s `Size` is signed, so this can raise an exception if given a+-- negative `Size`. embeddableOfHeight :: (Steppable t f, Functor f) => Gen (f Void) -> (Gen t -> Gen (f t)) -> Size -> Gen t
yaya-hedgehog.cabal view
@@ -1,5 +1,5 @@ name: yaya-hedgehog-version: 0.1.1.0+version: 0.1.2.1 synopsis: Hedgehog testing support for the Yaya recursion scheme library. description: If you use Yaya in your own code and have tests written