packages feed

recursion-schemes-ext 1.0.0.3 → 1.0.0.4

raw patch · 5 files changed

+34/−23 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ cabal.project.local view
@@ -0,0 +1,8 @@+constraints: recursion-schemes-ext +development+           , lens -test-doctests+           , comonad -test-doctests+           , semigroupoids -doctests+documentation: true+tests: true+benchmarks: true+optimization: 2
recursion-schemes-ext.cabal view
@@ -1,6 +1,6 @@-cabal-version: >=1.10+cabal-version: 1.18 name: recursion-schemes-ext-version: 1.0.0.3+version: 1.0.0.4 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2017 Vanessa McHale@@ -14,7 +14,8 @@ category: Control build-type: Simple extra-source-files:-    README.md+    cabal.project.local+extra-doc-files: README.md  source-repository head     type: git
src/Data/Functor/Foldable/Exotic.hs view
@@ -47,7 +47,7 @@ finish :: (Eq a) => (a -> a) -> a -> a finish = dock .* iterate --- | A map of F-algebras (pseudoprism)+-- | A map of \\( F \\)-algebras (pseudoprism) type Trans s a = ∀ f. Functor f => (f a -> a) -> f s -> s  -- | Mutumorphism@@ -56,28 +56,28 @@  -- | Entangle two hylomorphisms. scolio :: (Functor f, Functor g)-    => ((f b -> b) -> Trans b b) -- ^ A pseudoprism parametric in an F-algebra that allows `b` to inspect itself.-    -> ((a -> f a) -> Lens' a a) -- ^ A lens parametric in an F-coalgebra that allows `b` to inspect itself.-    -> (g b -> b) -- ^ A g-algebra-    -> (a -> g a) -- ^ A g-coalgebra-    -> (f b -> b) -- ^ An f-algebra-    -> (a -> f a) -- ^ An f-coalgebra+    => ((f b -> b) -> Trans b b) -- ^ A pseudoprism parametric in an \\( F \\)-algebra that allows @b@ to inspect itself.+    -> ((a -> f a) -> Lens' a a) -- ^ A lens parametric in an \\( F \\)-coalgebra that allows @b@ to inspect itself.+    -> (g b -> b) -- ^ A @g@-algebra+    -> (a -> g a) -- ^ A @g@-coalgebra+    -> (f b -> b) -- ^ An @f@-algebra+    -> (a -> f a) -- ^ An @f@-coalgebra     -> a -> b scolio p l alg coalg alg' coalg' = hylo (p alg' alg) (l coalg' coalg)  -- Entangle two anamorphisms. chema :: (Corecursive t', Functor f)-    => ((a -> f a) -> Lens' b b) -- ^ A lens parametric in an F-coalgebra that allows `b` to inspect itself.-    -> (a -> f a) -- ^ A (Base t)-coalgebra-    -> (b -> Base t' b) -- ^ A (Base t')-coalgebra+    => ((a -> f a) -> Lens' b b) -- ^ A lens parametric in an \\( F \\)-coalgebra that allows @b@ to inspect itself.+    -> (a -> f a) -- ^ A @(Base t)@-coalgebra+    -> (b -> Base t' b) -- ^ A @(Base t')@-coalgebra     -> b -> t' chema = (ana .*)  -- | A dendromorphism entangles two catamorphisms dendro :: (Recursive t', Functor f)-    => ((f a -> a) -> Trans b b) -- ^ A pseudoprism parametric in an F-algebra that allows `b` to inspect itself.-    -> (f a -> a) -- ^ A (Base t)-algebra-    -> (Base t' b -> b) -- ^ A (Base t')-algebra+    => ((f a -> a) -> Trans b b) -- ^ A pseudoprism parametric in an \\(F \\)-algebra that allows @b@ to inspect itself.+    -> (f a -> a) -- ^ A @(Base t)@-algebra+    -> (Base t' b -> b) -- ^ A @(Base t')@-algebra     -> t' -> b dendro = (cata .*) @@ -91,12 +91,12 @@  -- | A monadic catamorphism cataM :: (Recursive t, Traversable (Base t), Monad m) => (Base t a -> m a) -> (t -> m a)-cataM phi = c where c = phi <=< (mapM c . project)+cataM phi = c where c = phi <=< (traverse c . project)  -- | A monadic anamorphism anaM :: (Corecursive t, Traversable (Base t), Monad m) => (a -> m (Base t a)) -> (a -> m t)-anaM psi = a where a = (fmap embed . mapM a) <=< psi+anaM psi = a where a = (fmap embed . traverse a) <=< psi  -- | A monadic hylomorphism hyloM :: (Functor f, Monad m, Traversable f) => (f b -> m b) -> (a -> m (f a)) -> a -> m b-hyloM phi psi = h where h = phi <=< mapM h <=< psi+hyloM phi psi = h where h = phi <=< traverse h <=< psi
test/Examples.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE AllowAmbiguousTypes   #-}+-- {-# LANGUAGE AllowAmbiguousTypes   #-} {-# LANGUAGE DeriveAnyClass        #-} {-# LANGUAGE DeriveFoldable        #-} {-# LANGUAGE DeriveFunctor         #-}
test/Spec.hs view
@@ -32,11 +32,13 @@             collapseErnieSyntaxTree' ernieMult `shouldBe` collapseErnieSyntaxTree ernieMult         it "collapses complex syntax trees" $             collapseBertSyntaxTree bertComplex `shouldBe` Num 18-        it "should work would when triply wrapped (1/2)" $+        it "should work would when triply wrapped (1/4)" $             collapseErnieSyntaxTree (Ernie (Bert (Ernie (Num 15)))) `shouldBe` resultErnie         it "should work would when doubly wrapped" $             collapseBertSyntaxTree (Bert (Ernie (Num 15))) `shouldBe` (Num 15)-        it "should work would when triply wrapped (2/3)" $+        it "should work would when triply wrapped (2/4)" $             collapseBertSyntaxTree (Bert (Ernie bertComplex)) `shouldBe` (Num 18)-        it "should work would when triply wrapped (3/3)" $+        it "should work would when triply wrapped (3/4)" $             collapseBertSyntaxTree (Bert ernieComplex) `shouldBe` (Num 15)+        it "should work would when triply wrapped (4/4)" $+            collapseErnieSyntaxTree (Ernie (Bert ernieComplex)) `shouldBe` resultErnie