recursion 1.2.1.1 → 1.2.2.0
raw patch · 3 files changed
+44/−32 lines, 3 files
Files
- CHANGELOG.md +4/−0
- recursion.cabal +32/−32
- src/Control/Recursion.hs +8/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@ # recursion +## 1.2.2.0++* Add `zygoM`+ ## 1.2.1.1 * Performance improvements
recursion.cabal view
@@ -1,50 +1,50 @@-cabal-version: 1.18-name: recursion-version: 1.2.1.1-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2018 Vanessa McHale-maintainer: vanessa.mchale@iohk.io-author: Vanessa McHale-bug-reports: https://hub.darcs.net/vmchale/recursion/issues-synopsis: A recursion schemes library for GHC.+cabal-version: 1.18+name: recursion+version: 1.2.2.0+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2018 Vanessa McHale+maintainer: vanessa.mchale@iohk.io+author: Vanessa McHale+bug-reports: https://hub.darcs.net/vmchale/recursion/issues+synopsis: A recursion schemes library for GHC. description: A performant recursion schemes library for Haskell with minimal dependencies-category: Control, Recursion-build-type: Simple-extra-source-files:- cabal.project.local-extra-doc-files: README.md- CHANGELOG.md+category: Control, Recursion+build-type: Simple+extra-source-files: cabal.project.local+extra-doc-files:+ README.md+ CHANGELOG.md source-repository head- type: darcs+ type: darcs location: https://hub.darcs.net/vmchale/recursion flag development- description:- Enable `-Werror`- default: False- manual: True+ description: Enable `-Werror`+ default: False+ manual: True library- exposed-modules:- Control.Recursion- hs-source-dirs: src+ exposed-modules: Control.Recursion+ hs-source-dirs: src default-language: Haskell2010- other-extensions: DeriveFunctor FlexibleContexts- ExistentialQuantification RankNTypes TypeFamilies- ghc-options: -Wall+ other-extensions:+ DeriveFunctor FlexibleContexts ExistentialQuantification RankNTypes+ TypeFamilies+ ghc-options: -Wall build-depends: base >=4.9 && <5, composition-prelude -any- + if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0)- ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates- -Wredundant-constraints -Wnoncanonical-monad-instances- + ghc-options:+ -Wincomplete-uni-patterns -Wincomplete-record-updates+ -Wredundant-constraints -Wnoncanonical-monad-instances+ if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists
src/Control/Recursion.hs view
@@ -36,6 +36,7 @@ , mcata -- * Monadic recursion schemes , cataM+ , zygoM , anaM , hyloM -- * Mutual recursion@@ -47,6 +48,9 @@ , colambek , hoist , refix+ -- * Additional types+ , Trans+ , Lens ) where import Control.Arrow ((&&&))@@ -173,6 +177,10 @@ cataM :: (Recursive t, Traversable (Base t), Monad m) => (Base t a -> m a) -> t -> m a cataM f = c where c = f <=< (traverse c . project)++-- (Base t b -> b) -> (Base t (b, a) -> a) -> t -> a+zygoM :: (Recursive t, Traversable (Base t), Monad m) => (Base t b -> m b) -> (Base t (b, a) -> m a) -> t -> m a+zygoM f g = fmap snd . cataM (\x -> (,) <$> f (fmap fst x) <*> g x) anaM :: (Corecursive t, Traversable (Base t), Monad m) => (a -> m (Base t a)) -> a -> m t anaM f = a where a = (fmap embed . traverse a) <=< f