-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Generalized bananas, lenses and barbed wire
--
-- Generalized bananas, lenses and barbed wire
--
-- Changes since 0.4.2:
--
--
-- - Added futumorphisms
--
--
-- Changes since 0.2.2:
--
--
-- - Split distHisto from distGHisto
-- - Added zygohistomorphic prepromorphisms
--
--
-- Changes since 0.2.1:
--
--
-- - Added (generalized) prepro- and postpro- morphisms
--
--
-- Changes since 0.2:
--
--
-- - Added Elgot (co)algebras
--
--
-- Changes since 0.1:
--
--
-- - Removed dependency on Foldable from Mendler-style recursion
-- schemes
-- - Added Lambek's Lemma
--
@package recursion-schemes
@version 0.4.3
module Data.Functor.Foldable
newtype Fix f
Fix :: (f (Fix f)) -> Fix f
newtype Mu f
Mu :: (forall a. (f a -> a) -> a) -> Mu f
data Nu f
Nu :: (a -> f a) -> a -> Nu f
class Functor (Base t) => Foldable t
project :: Foldable t => t -> Base t t
cata :: Foldable t => (Base t a -> a) -> t -> a
para :: (Foldable t, Unfoldable t) => (Base t (t, a) -> a) -> t -> a
gpara :: (Foldable t, Unfoldable t, Comonad w) => (forall b. Base t (w b) -> w (Base t b)) -> (Base t (EnvT t w a) -> a) -> t -> a
prepro :: (Foldable t, Unfoldable t) => (forall b. Base t b -> Base t b) -> (Base t a -> a) -> t -> a
gprepro :: (Foldable t, Unfoldable t, Comonad w) => (forall b. Base t (w b) -> w (Base t b)) -> (forall c. Base t c -> Base t c) -> (Base t (w a) -> a) -> t -> a
-- | A generalized catamorphism
gcata :: (Foldable t, Comonad w) => (forall b. Base t (w b) -> w (Base t b)) -> (Base t (w a) -> a) -> t -> a
zygo :: Foldable t => (Base t b -> b) -> (Base t (b, a) -> a) -> t -> a
gzygo :: (Foldable t, Comonad w) => (Base t b -> b) -> (forall c. Base t (w c) -> w (Base t c)) -> (Base t (EnvT b w a) -> a) -> t -> a
-- | Course-of-value iteration
histo :: Foldable t => (Base t (Stream (Base t) a) -> a) -> t -> a
ghisto :: (Foldable t, Functor h) => (forall b. Base t (h b) -> h (Base t b)) -> (Base t (Stream h a) -> a) -> t -> a
futu :: Unfoldable t => (a -> Base t (Free (Base t) a)) -> a -> t
distCata :: Functor f => f (Identity a) -> Identity (f a)
distPara :: Unfoldable t => Base t (t, a) -> (t, Base t a)
distParaT :: (Unfoldable t, Comonad w) => (forall b. Base t (w b) -> w (Base t b)) -> Base t (EnvT t w a) -> EnvT t w (Base t a)
distZygo :: Functor f => (f b -> b) -> (f (b, a) -> (b, f a))
distZygoT :: (Functor f, Comonad w) => (f b -> b) -> (forall c. f (w c) -> w (f c)) -> f (EnvT b w a) -> EnvT b w (f a)
distHisto :: Functor f => f (Stream f a) -> Stream f (f a)
distGHisto :: (Functor f, Functor h) => (forall b. f (h b) -> h (f b)) -> f (Stream h a) -> Stream h (f a)
distFutu :: Functor f => Free f (f a) -> f (Free f a)
distGFutu :: (Functor f, Functor h) => (forall b. h (f b) -> f (h b)) -> Free h (f a) -> f (Free h a)
class Functor (Base t) => Unfoldable t
embed :: Unfoldable t => Base t t -> t
ana :: Unfoldable t => (a -> Base t a) -> a -> t
apo :: (Unfoldable t, Foldable t) => (a -> Base t (Either t a)) -> a -> t
postpro :: (Unfoldable t, Foldable t) => (forall b. Base t b -> Base t b) -> (a -> Base t a) -> a -> t
gpostpro :: (Unfoldable t, Foldable t, Monad m) => (forall b. m (Base t b) -> Base t (m b)) -> (forall c. Base t c -> Base t c) -> (a -> Base t (m a)) -> a -> t
-- | A generalized anamorphism
gana :: (Unfoldable t, Monad m) => (forall b. m (Base t b) -> Base t (m b)) -> (a -> Base t (m a)) -> a -> t
distAna :: Functor f => Identity (f a) -> f (Identity a)
distApo :: Foldable t => Either t (Base t a) -> Base t (Either t a)
distGApo :: Functor f => (b -> f b) -> Either b (f a) -> f (Either b a)
hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b
-- | A generalized hylomorphism
ghylo :: (Comonad w, Functor f, Monad m) => (forall c. f (w c) -> w (f c)) -> (forall d. m (f d) -> f (m d)) -> (f (w b) -> b) -> (a -> f (m a)) -> a -> b
refix :: (Foldable s, Unfoldable t, (Base s) ~ (Base t)) => s -> t
fold :: Foldable t => (Base t a -> a) -> t -> a
gfold :: (Foldable t, Comonad w) => (forall b. Base t (w b) -> w (Base t b)) -> (Base t (w a) -> a) -> t -> a
unfold :: Unfoldable t => (a -> Base t a) -> a -> t
gunfold :: (Unfoldable t, Monad m) => (forall b. m (Base t b) -> Base t (m b)) -> (a -> Base t (m a)) -> a -> t
refold :: Functor f => (f b -> b) -> (a -> f a) -> a -> b
grefold :: (Comonad w, Functor f, Monad m) => (forall c. f (w c) -> w (f c)) -> (forall d. m (f d) -> f (m d)) -> (f (w b) -> b) -> (a -> f (m a)) -> a -> b
-- | Mendler-style iteration
mcata :: (forall y. (y -> c) -> f y -> c) -> Fix f -> c
-- | Mendler-style course-of-value iteration
mhisto :: (forall y. (y -> c) -> (y -> f y) -> f y -> c) -> Fix f -> c
-- | Elgot algebras
elgot :: Functor f => (f a -> a) -> (b -> Either a (f b)) -> b -> a
-- | Elgot coalgebras:
-- http://comonad.com/reader/2008/elgot-coalgebras/
coelgot :: Functor f => ((a, f b) -> b) -> (a -> f a) -> a -> b
-- | Zygohistomorphic prepromorphisms:
--
-- A corrected and modernized version of
-- http://www.haskell.org/haskellwiki/Zygohistomorphic_prepromorphisms
zygoHistoPrepro :: (Unfoldable t, Foldable t) => (Base t b -> b) -> (forall c. Base t c -> Base t c) -> (Base t (EnvT b (Stream (Base t)) a) -> a) -> t -> a
instance Read (f (Fix f)) => Read (Fix f)
instance Show (f (Fix f)) => Show (Fix f)
instance Ord (f (Fix f)) => Ord (Fix f)
instance Eq (f (Fix f)) => Eq (Fix f)
instance (Eq a, Eq b) => Eq (Prim [a] b)
instance (Ord a, Ord b) => Ord (Prim [a] b)
instance (Show a, Show b) => Show (Prim [a] b)
instance (Read a, Read b) => Read (Prim [a] b)
instance (Functor f, Read (f (Fix f)), Read (Fix f)) => Read (Nu f)
instance (Functor f, Show (f (Fix f)), Show (Fix f)) => Show (Nu f)
instance (Functor f, Ord (f (Fix f)), Ord (Fix f)) => Ord (Nu f)
instance (Functor f, Eq (f (Fix f)), Eq (Fix f)) => Eq (Nu f)
instance Functor f => Foldable (Nu f)
instance Functor f => Unfoldable (Nu f)
instance (Functor f, Read (f (Fix f)), Read (Fix f)) => Read (Mu f)
instance (Functor f, Show (f (Fix f)), Show (Fix f)) => Show (Mu f)
instance (Functor f, Ord (f (Fix f)), Ord (Fix f)) => Ord (Mu f)
instance (Functor f, Eq (f (Fix f)), Eq (Fix f)) => Eq (Mu f)
instance Functor f => Unfoldable (Mu f)
instance Functor f => Foldable (Mu f)
instance Functor f => Unfoldable (Fix f)
instance Functor f => Foldable (Fix f)
instance (Typeable1 f, Data (f (Fix f))) => Data (Fix f)
instance Typeable1 f => Typeable (Fix f)
instance Unfoldable (Either a b)
instance Foldable (Either a b)
instance Unfoldable (Maybe a)
instance Foldable (Maybe a)
instance Unfoldable [a]
instance Foldable [a]
instance Functor (Prim [a])