recursion-schemes 0.2 → 0.2.1
raw patch · 2 files changed
+17/−1 lines, 2 files
Files
- Data/Functor/Foldable.hs +12/−0
- recursion-schemes.cabal +5/−1
Data/Functor/Foldable.hs view
@@ -54,6 +54,9 @@ -- * Mendler-style , mcata , mhisto+ -- * Elgot (co)algebras+ , elgot+ , coelgot ) where import Control.Applicative@@ -62,6 +65,7 @@ import Control.Comonad.Trans.Env import Control.Monad (liftM, join) import Data.Functor.Identity+import Control.Arrow import Data.Function (on) import qualified Data.Stream.Branching as Stream import Data.Stream.Branching (Stream(..))@@ -354,3 +358,11 @@ -- | Mendler-style course-of-value iteration mhisto :: (forall y. (y -> c) -> (y -> f y) -> f y -> c) -> Fix f -> c mhisto psi = psi (mhisto psi) unfix . unfix++-- | Elgot algebras+elgot :: Functor f => (f a -> a) -> (b -> Either a (f b)) -> b -> a+elgot phi psi = h where h = (id ||| phi . fmap h) . psi++-- | Elgot coalgebras: <http://comonad.com/reader/2008/elgot-coalgebras/>+coelgot :: Functor f => ((a, f b) -> b) -> (a -> f a) -> a -> b+coelgot phi psi = h where h = phi . (id &&& fmap h . psi)
recursion-schemes.cabal view
@@ -1,6 +1,6 @@ name: recursion-schemes category: Control, Recursion-version: 0.2+version: 0.2.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -13,6 +13,10 @@ description: Generalized bananas, lenses and barbed wire . + /Changes since 0.2/:+ .+ * Added Elgot (co)algebras+ . /Changes since 0.1/: . * Removed dependency on Foldable from Mendler-style recursion schemes