micro-recursion-schemes-5.0.2.2: Simple recursion schemes

Copyright (C) 2008-2015 Edward Kmett BSD-style (see the file LICENSE) Edward Kmett experimental non-portable Safe Haskell2010

Data.Functor.Foldable

Description

Synopsis

# Base functors for fixed points

type family Base t :: * -> * Source #

Instances

 type Base Natural Source # type Base Natural = Maybe type Base [a] Source # type Base [a] = ListF a type Base (Maybe a) Source # type Base (Maybe a) = Const * (Maybe a) type Base (NonEmpty a) Source # type Base (NonEmpty a) = NonEmptyF a type Base (Nu f) Source # type Base (Nu f) = f type Base (Mu f) Source # type Base (Mu f) = f type Base (Fix f) Source # type Base (Fix f) = f type Base (Either a b) Source # type Base (Either a b) = Const * (Either a b)

data ListF a b Source #

Base functor of [].

Constructors

 Nil Cons a b

Instances

 Source # Methodsbitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> ListF a b -> f (ListF c d) # Source # Methodsbifold :: Monoid m => ListF m m -> m #bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> ListF a b -> m #bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> ListF a b -> c #bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> ListF a b -> c # Source # Methodsbimap :: (a -> b) -> (c -> d) -> ListF a c -> ListF b d #first :: (a -> b) -> ListF a c -> ListF b c #second :: (b -> c) -> ListF a b -> ListF a c # Source # MethodsliftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> ListF a c -> ListF b d -> Bool # Source # MethodsliftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> ListF a c -> ListF b d -> Ordering # Source # MethodsliftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (ListF a b) #liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [ListF a b] #liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (ListF a b) #liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [ListF a b] # Source # MethodsliftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> ListF a b -> ShowS #liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [ListF a b] -> ShowS # Functor (ListF a) Source # Methodsfmap :: (a -> b) -> ListF a a -> ListF a b #(<\$) :: a -> ListF a b -> ListF a a # Source # Methodsfold :: Monoid m => ListF a m -> m #foldMap :: Monoid m => (a -> m) -> ListF a a -> m #foldr :: (a -> b -> b) -> b -> ListF a a -> b #foldr' :: (a -> b -> b) -> b -> ListF a a -> b #foldl :: (b -> a -> b) -> b -> ListF a a -> b #foldl' :: (b -> a -> b) -> b -> ListF a a -> b #foldr1 :: (a -> a -> a) -> ListF a a -> a #foldl1 :: (a -> a -> a) -> ListF a a -> a #toList :: ListF a a -> [a] #null :: ListF a a -> Bool #length :: ListF a a -> Int #elem :: Eq a => a -> ListF a a -> Bool #maximum :: Ord a => ListF a a -> a #minimum :: Ord a => ListF a a -> a #sum :: Num a => ListF a a -> a #product :: Num a => ListF a a -> a # Source # Methodstraverse :: Applicative f => (a -> f b) -> ListF a a -> f (ListF a b) #sequenceA :: Applicative f => ListF a (f a) -> f (ListF a a) #mapM :: Monad m => (a -> m b) -> ListF a a -> m (ListF a b) #sequence :: Monad m => ListF a (m a) -> m (ListF a a) # Eq a => Eq1 (ListF a) Source # MethodsliftEq :: (a -> b -> Bool) -> ListF a a -> ListF a b -> Bool # Ord a => Ord1 (ListF a) Source # MethodsliftCompare :: (a -> b -> Ordering) -> ListF a a -> ListF a b -> Ordering # Read a => Read1 (ListF a) Source # MethodsliftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ListF a a) #liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ListF a a] #liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ListF a a) #liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ListF a a] # Show a => Show1 (ListF a) Source # MethodsliftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ListF a a -> ShowS #liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ListF a a] -> ShowS # Source # Associated Typestype Rep1 (ListF a) (f :: ListF a -> *) :: k -> * # Methodsfrom1 :: f a -> Rep1 (ListF a) f a #to1 :: Rep1 (ListF a) f a -> f a # (Eq b, Eq a) => Eq (ListF a b) Source # Methods(==) :: ListF a b -> ListF a b -> Bool #(/=) :: ListF a b -> ListF a b -> Bool # (Ord b, Ord a) => Ord (ListF a b) Source # Methodscompare :: ListF a b -> ListF a b -> Ordering #(<) :: ListF a b -> ListF a b -> Bool #(<=) :: ListF a b -> ListF a b -> Bool #(>) :: ListF a b -> ListF a b -> Bool #(>=) :: ListF a b -> ListF a b -> Bool #max :: ListF a b -> ListF a b -> ListF a b #min :: ListF a b -> ListF a b -> ListF a b # (Read b, Read a) => Read (ListF a b) Source # MethodsreadsPrec :: Int -> ReadS (ListF a b) #readList :: ReadS [ListF a b] #readPrec :: ReadPrec (ListF a b) #readListPrec :: ReadPrec [ListF a b] # (Show b, Show a) => Show (ListF a b) Source # MethodsshowsPrec :: Int -> ListF a b -> ShowS #show :: ListF a b -> String #showList :: [ListF a b] -> ShowS # Generic (ListF a b) Source # Associated Typestype Rep (ListF a b) :: * -> * # Methodsfrom :: ListF a b -> Rep (ListF a b) x #to :: Rep (ListF a b) x -> ListF a b # type Rep1 * (ListF a) Source # type Rep1 * (ListF a) = D1 * (MetaData "ListF" "Data.Functor.Foldable" "micro-recursion-schemes-5.0.2.2-EZxjQJPFfmCD64aBnmKRyJ" False) ((:+:) * (C1 * (MetaCons "Nil" PrefixI False) (U1 *)) (C1 * (MetaCons "Cons" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1)))) type Rep (ListF a b) Source # type Rep (ListF a b) = D1 * (MetaData "ListF" "Data.Functor.Foldable" "micro-recursion-schemes-5.0.2.2-EZxjQJPFfmCD64aBnmKRyJ" False) ((:+:) * (C1 * (MetaCons "Nil" PrefixI False) (U1 *)) (C1 * (MetaCons "Cons" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * a)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * b)))))

# Fixed points

newtype Fix f Source #

Constructors

 Fix (f (Fix f))

Instances

 Eq1 f => Eq (Fix f) Source # Methods(==) :: Fix f -> Fix f -> Bool #(/=) :: Fix f -> Fix f -> Bool # (Typeable (* -> *) f, Data (f (Fix f))) => Data (Fix f) Source # Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Fix f -> c (Fix f) #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Fix f) #toConstr :: Fix f -> Constr #dataTypeOf :: Fix f -> DataType #dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Fix f)) #dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Fix f)) #gmapT :: (forall b. Data b => b -> b) -> Fix f -> Fix f #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Fix f -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Fix f -> r #gmapQ :: (forall d. Data d => d -> u) -> Fix f -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Fix f -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Fix f -> m (Fix f) # Ord1 f => Ord (Fix f) Source # Methodscompare :: Fix f -> Fix f -> Ordering #(<) :: Fix f -> Fix f -> Bool #(<=) :: Fix f -> Fix f -> Bool #(>) :: Fix f -> Fix f -> Bool #(>=) :: Fix f -> Fix f -> Bool #max :: Fix f -> Fix f -> Fix f #min :: Fix f -> Fix f -> Fix f # Read1 f => Read (Fix f) Source # MethodsreadsPrec :: Int -> ReadS (Fix f) #readList :: ReadS [Fix f] #readPrec :: ReadPrec (Fix f) # Show1 f => Show (Fix f) Source # MethodsshowsPrec :: Int -> Fix f -> ShowS #show :: Fix f -> String #showList :: [Fix f] -> ShowS # Functor f => Corecursive (Fix f) Source # Methodsembed :: Base (Fix f) (Fix f) -> Fix f Source #ana :: (a -> Base (Fix f) a) -> a -> Fix f Source #apo :: (a -> Base (Fix f) (Either (Fix f) a)) -> a -> Fix f Source #postpro :: Recursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (a -> Base (Fix f) a) -> a -> Fix f Source #gpostpro :: (Recursive (Fix f), Monad m) => (forall b. m (Base (Fix f) b) -> Base (Fix f) (m b)) -> (forall c. Base (Fix f) c -> Base (Fix f) c) -> (a -> Base (Fix f) (m a)) -> a -> Fix f Source # Functor f => Recursive (Fix f) Source # Methodsproject :: Fix f -> Base (Fix f) (Fix f) Source #cata :: (Base (Fix f) a -> a) -> Fix f -> a Source #para :: (Base (Fix f) (Fix f, a) -> a) -> Fix f -> a Source #prepro :: Corecursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (Base (Fix f) a -> a) -> Fix f -> a Source # type Base (Fix f) Source # type Base (Fix f) = f

unfix :: Fix f -> f (Fix f) Source #

newtype Mu f Source #

Constructors

 Mu (forall a. (f a -> a) -> a)

Instances

 (Functor f, Eq1 f) => Eq (Mu f) Source # Methods(==) :: Mu f -> Mu f -> Bool #(/=) :: Mu f -> Mu f -> Bool # (Functor f, Ord1 f) => Ord (Mu f) Source # Methodscompare :: Mu f -> Mu f -> Ordering #(<) :: Mu f -> Mu f -> Bool #(<=) :: Mu f -> Mu f -> Bool #(>) :: Mu f -> Mu f -> Bool #(>=) :: Mu f -> Mu f -> Bool #max :: Mu f -> Mu f -> Mu f #min :: Mu f -> Mu f -> Mu f # (Functor f, Read1 f) => Read (Mu f) Source # MethodsreadsPrec :: Int -> ReadS (Mu f) #readList :: ReadS [Mu f] #readPrec :: ReadPrec (Mu f) # (Functor f, Show1 f) => Show (Mu f) Source # MethodsshowsPrec :: Int -> Mu f -> ShowS #show :: Mu f -> String #showList :: [Mu f] -> ShowS # Functor f => Corecursive (Mu f) Source # Methodsembed :: Base (Mu f) (Mu f) -> Mu f Source #ana :: (a -> Base (Mu f) a) -> a -> Mu f Source #apo :: (a -> Base (Mu f) (Either (Mu f) a)) -> a -> Mu f Source #postpro :: Recursive (Mu f) => (forall b. Base (Mu f) b -> Base (Mu f) b) -> (a -> Base (Mu f) a) -> a -> Mu f Source #gpostpro :: (Recursive (Mu f), Monad m) => (forall b. m (Base (Mu f) b) -> Base (Mu f) (m b)) -> (forall c. Base (Mu f) c -> Base (Mu f) c) -> (a -> Base (Mu f) (m a)) -> a -> Mu f Source # Functor f => Recursive (Mu f) Source # Methodsproject :: Mu f -> Base (Mu f) (Mu f) Source #cata :: (Base (Mu f) a -> a) -> Mu f -> a Source #para :: (Base (Mu f) (Mu f, a) -> a) -> Mu f -> a Source #prepro :: Corecursive (Mu f) => (forall b. Base (Mu f) b -> Base (Mu f) b) -> (Base (Mu f) a -> a) -> Mu f -> a Source # type Base (Mu f) Source # type Base (Mu f) = f

data Nu f where Source #

Constructors

 Nu :: (a -> f a) -> a -> Nu f

Instances

 (Functor f, Eq1 f) => Eq (Nu f) Source # Methods(==) :: Nu f -> Nu f -> Bool #(/=) :: Nu f -> Nu f -> Bool # (Functor f, Ord1 f) => Ord (Nu f) Source # Methodscompare :: Nu f -> Nu f -> Ordering #(<) :: Nu f -> Nu f -> Bool #(<=) :: Nu f -> Nu f -> Bool #(>) :: Nu f -> Nu f -> Bool #(>=) :: Nu f -> Nu f -> Bool #max :: Nu f -> Nu f -> Nu f #min :: Nu f -> Nu f -> Nu f # (Functor f, Read1 f) => Read (Nu f) Source # MethodsreadsPrec :: Int -> ReadS (Nu f) #readList :: ReadS [Nu f] #readPrec :: ReadPrec (Nu f) # (Functor f, Show1 f) => Show (Nu f) Source # MethodsshowsPrec :: Int -> Nu f -> ShowS #show :: Nu f -> String #showList :: [Nu f] -> ShowS # Functor f => Corecursive (Nu f) Source # Methodsembed :: Base (Nu f) (Nu f) -> Nu f Source #ana :: (a -> Base (Nu f) a) -> a -> Nu f Source #apo :: (a -> Base (Nu f) (Either (Nu f) a)) -> a -> Nu f Source #postpro :: Recursive (Nu f) => (forall b. Base (Nu f) b -> Base (Nu f) b) -> (a -> Base (Nu f) a) -> a -> Nu f Source #gpostpro :: (Recursive (Nu f), Monad m) => (forall b. m (Base (Nu f) b) -> Base (Nu f) (m b)) -> (forall c. Base (Nu f) c -> Base (Nu f) c) -> (a -> Base (Nu f) (m a)) -> a -> Nu f Source # Functor f => Recursive (Nu f) Source # Methodsproject :: Nu f -> Base (Nu f) (Nu f) Source #cata :: (Base (Nu f) a -> a) -> Nu f -> a Source #para :: (Base (Nu f) (Nu f, a) -> a) -> Nu f -> a Source #prepro :: Corecursive (Nu f) => (forall b. Base (Nu f) b -> Base (Nu f) b) -> (Base (Nu f) a -> a) -> Nu f -> a Source # type Base (Nu f) Source # type Base (Nu f) = f

# Folding

class Functor (Base t) => Recursive t where Source #

Minimal complete definition

project

Methods

project :: t -> Base t t Source #

Arguments

 :: (Base t a -> a) a (Base t)-algebra -> t fixed point -> a result

para :: (Base t (t, a) -> a) -> t -> a Source #

prepro :: Corecursive t => (forall b. Base t b -> Base t b) -> (Base t a -> a) -> t -> a Source #

Fokkinga's prepromorphism

Instances

 Source # Methodscata :: (Base Natural a -> a) -> Natural -> a Source #para :: (Base Natural (Natural, a) -> a) -> Natural -> a Source #prepro :: Corecursive Natural => (forall b. Base Natural b -> Base Natural b) -> (Base Natural a -> a) -> Natural -> a Source # Recursive [a] Source # Methodsproject :: [a] -> Base [a] [a] Source #cata :: (Base [a] a -> a) -> [a] -> a Source #para :: (Base [a] ([a], a) -> a) -> [a] -> a Source #prepro :: Corecursive [a] => (forall b. Base [a] b -> Base [a] b) -> (Base [a] a -> a) -> [a] -> a Source # Source # Methodsproject :: Maybe a -> Base (Maybe a) (Maybe a) Source #cata :: (Base (Maybe a) a -> a) -> Maybe a -> a Source #para :: (Base (Maybe a) (Maybe a, a) -> a) -> Maybe a -> a Source #prepro :: Corecursive (Maybe a) => (forall b. Base (Maybe a) b -> Base (Maybe a) b) -> (Base (Maybe a) a -> a) -> Maybe a -> a Source # Source # Methodsproject :: NonEmpty a -> Base (NonEmpty a) (NonEmpty a) Source #cata :: (Base (NonEmpty a) a -> a) -> NonEmpty a -> a Source #para :: (Base (NonEmpty a) (NonEmpty a, a) -> a) -> NonEmpty a -> a Source #prepro :: Corecursive (NonEmpty a) => (forall b. Base (NonEmpty a) b -> Base (NonEmpty a) b) -> (Base (NonEmpty a) a -> a) -> NonEmpty a -> a Source # Functor f => Recursive (Nu f) Source # Methodsproject :: Nu f -> Base (Nu f) (Nu f) Source #cata :: (Base (Nu f) a -> a) -> Nu f -> a Source #para :: (Base (Nu f) (Nu f, a) -> a) -> Nu f -> a Source #prepro :: Corecursive (Nu f) => (forall b. Base (Nu f) b -> Base (Nu f) b) -> (Base (Nu f) a -> a) -> Nu f -> a Source # Functor f => Recursive (Mu f) Source # Methodsproject :: Mu f -> Base (Mu f) (Mu f) Source #cata :: (Base (Mu f) a -> a) -> Mu f -> a Source #para :: (Base (Mu f) (Mu f, a) -> a) -> Mu f -> a Source #prepro :: Corecursive (Mu f) => (forall b. Base (Mu f) b -> Base (Mu f) b) -> (Base (Mu f) a -> a) -> Mu f -> a Source # Functor f => Recursive (Fix f) Source # Methodsproject :: Fix f -> Base (Fix f) (Fix f) Source #cata :: (Base (Fix f) a -> a) -> Fix f -> a Source #para :: (Base (Fix f) (Fix f, a) -> a) -> Fix f -> a Source #prepro :: Corecursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (Base (Fix f) a -> a) -> Fix f -> a Source # Recursive (Either a b) Source # Methodsproject :: Either a b -> Base (Either a b) (Either a b) Source #cata :: (Base (Either a b) a -> a) -> Either a b -> a Source #para :: (Base (Either a b) (Either a b, a) -> a) -> Either a b -> a Source #prepro :: Corecursive (Either a b) => (forall c. Base (Either a b) c -> Base (Either a b) c) -> (Base (Either a b) a -> a) -> Either a b -> a Source #

## Combinators

zygo :: Recursive t => (Base t b -> b) -> (Base t (b, a) -> a) -> t -> a Source #

mutu :: Recursive t => (Base t (a, a) -> a) -> (Base t (a, a) -> a) -> t -> a Source #

# Unfolding

class Functor (Base t) => Corecursive t where Source #

Minimal complete definition

embed

Methods

embed :: Base t t -> t Source #

Arguments

 :: (a -> Base t a) a (Base t)-coalgebra -> a seed -> t resulting fixed point

apo :: (a -> Base t (Either t a)) -> a -> t Source #

postpro :: Recursive t => (forall b. Base t b -> Base t b) -> (a -> Base t a) -> a -> t Source #

Fokkinga's postpromorphism

gpostpro :: (Recursive 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 Source #

A generalized postpromorphism

Instances

 Source # Methodsana :: (a -> Base Natural a) -> a -> Natural Source #apo :: (a -> Base Natural (Either Natural a)) -> a -> Natural Source #postpro :: Recursive Natural => (forall b. Base Natural b -> Base Natural b) -> (a -> Base Natural a) -> a -> Natural Source #gpostpro :: (Recursive Natural, Monad m) => (forall b. m (Base Natural b) -> Base Natural (m b)) -> (forall c. Base Natural c -> Base Natural c) -> (a -> Base Natural (m a)) -> a -> Natural Source # Corecursive [a] Source # Methodsembed :: Base [a] [a] -> [a] Source #ana :: (a -> Base [a] a) -> a -> [a] Source #apo :: (a -> Base [a] (Either [a] a)) -> a -> [a] Source #postpro :: Recursive [a] => (forall b. Base [a] b -> Base [a] b) -> (a -> Base [a] a) -> a -> [a] Source #gpostpro :: (Recursive [a], Monad m) => (forall b. m (Base [a] b) -> Base [a] (m b)) -> (forall c. Base [a] c -> Base [a] c) -> (a -> Base [a] (m a)) -> a -> [a] Source # Source # Methodsembed :: Base (Maybe a) (Maybe a) -> Maybe a Source #ana :: (a -> Base (Maybe a) a) -> a -> Maybe a Source #apo :: (a -> Base (Maybe a) (Either (Maybe a) a)) -> a -> Maybe a Source #postpro :: Recursive (Maybe a) => (forall b. Base (Maybe a) b -> Base (Maybe a) b) -> (a -> Base (Maybe a) a) -> a -> Maybe a Source #gpostpro :: (Recursive (Maybe a), Monad m) => (forall b. m (Base (Maybe a) b) -> Base (Maybe a) (m b)) -> (forall c. Base (Maybe a) c -> Base (Maybe a) c) -> (a -> Base (Maybe a) (m a)) -> a -> Maybe a Source # Source # Methodsembed :: Base (NonEmpty a) (NonEmpty a) -> NonEmpty a Source #ana :: (a -> Base (NonEmpty a) a) -> a -> NonEmpty a Source #apo :: (a -> Base (NonEmpty a) (Either (NonEmpty a) a)) -> a -> NonEmpty a Source #postpro :: Recursive (NonEmpty a) => (forall b. Base (NonEmpty a) b -> Base (NonEmpty a) b) -> (a -> Base (NonEmpty a) a) -> a -> NonEmpty a Source #gpostpro :: (Recursive (NonEmpty a), Monad m) => (forall b. m (Base (NonEmpty a) b) -> Base (NonEmpty a) (m b)) -> (forall c. Base (NonEmpty a) c -> Base (NonEmpty a) c) -> (a -> Base (NonEmpty a) (m a)) -> a -> NonEmpty a Source # Functor f => Corecursive (Nu f) Source # Methodsembed :: Base (Nu f) (Nu f) -> Nu f Source #ana :: (a -> Base (Nu f) a) -> a -> Nu f Source #apo :: (a -> Base (Nu f) (Either (Nu f) a)) -> a -> Nu f Source #postpro :: Recursive (Nu f) => (forall b. Base (Nu f) b -> Base (Nu f) b) -> (a -> Base (Nu f) a) -> a -> Nu f Source #gpostpro :: (Recursive (Nu f), Monad m) => (forall b. m (Base (Nu f) b) -> Base (Nu f) (m b)) -> (forall c. Base (Nu f) c -> Base (Nu f) c) -> (a -> Base (Nu f) (m a)) -> a -> Nu f Source # Functor f => Corecursive (Mu f) Source # Methodsembed :: Base (Mu f) (Mu f) -> Mu f Source #ana :: (a -> Base (Mu f) a) -> a -> Mu f Source #apo :: (a -> Base (Mu f) (Either (Mu f) a)) -> a -> Mu f Source #postpro :: Recursive (Mu f) => (forall b. Base (Mu f) b -> Base (Mu f) b) -> (a -> Base (Mu f) a) -> a -> Mu f Source #gpostpro :: (Recursive (Mu f), Monad m) => (forall b. m (Base (Mu f) b) -> Base (Mu f) (m b)) -> (forall c. Base (Mu f) c -> Base (Mu f) c) -> (a -> Base (Mu f) (m a)) -> a -> Mu f Source # Functor f => Corecursive (Fix f) Source # Methodsembed :: Base (Fix f) (Fix f) -> Fix f Source #ana :: (a -> Base (Fix f) a) -> a -> Fix f Source #apo :: (a -> Base (Fix f) (Either (Fix f) a)) -> a -> Fix f Source #postpro :: Recursive (Fix f) => (forall b. Base (Fix f) b -> Base (Fix f) b) -> (a -> Base (Fix f) a) -> a -> Fix f Source #gpostpro :: (Recursive (Fix f), Monad m) => (forall b. m (Base (Fix f) b) -> Base (Fix f) (m b)) -> (forall c. Base (Fix f) c -> Base (Fix f) c) -> (a -> Base (Fix f) (m a)) -> a -> Fix f Source # Corecursive (Either a b) Source # Methodsembed :: Base (Either a b) (Either a b) -> Either a b Source #ana :: (a -> Base (Either a b) a) -> a -> Either a b Source #apo :: (a -> Base (Either a b) (Either (Either a b) a)) -> a -> Either a b Source #postpro :: Recursive (Either a b) => (forall c. Base (Either a b) c -> Base (Either a b) c) -> (a -> Base (Either a b) a) -> a -> Either a b Source #gpostpro :: (Recursive (Either a b), Monad m) => (forall c. m (Base (Either a b) c) -> Base (Either a b) (m c)) -> (forall c. Base (Either a b) c -> Base (Either a b) c) -> (a -> Base (Either a b) (m a)) -> a -> Either a b Source #

# Refolding

hylo :: Functor f => (f b -> b) -> (a -> f a) -> a -> b Source #

## Changing representation

refix :: (Recursive s, Corecursive t, Base s ~ Base t) => s -> t Source #

# Mendler-style

mcata :: (forall y. (y -> c) -> f y -> c) -> Fix f -> c Source #

Mendler-style iteration

mhisto :: (forall y. (y -> c) -> (y -> f y) -> f y -> c) -> Fix f -> c Source #

Mendler-style course-of-value iteration

# Elgot (co)algebras

elgot :: Functor f => (f a -> a) -> (b -> Either a (f b)) -> b -> a Source #

Elgot algebras

coelgot :: Functor f => ((a, f b) -> b) -> (a -> f a) -> a -> b Source #