yaya-1.0.0.0: Total recursion schemes.
Safe HaskellSafe
LanguageHaskell2010

Yaya.Fold

Synopsis

Documentation

type Algebra (c :: k1 -> k2 -> k) (f :: k2 -> k1) (a :: k2) = c (f a) a Source #

type AlgebraM (c :: k1 -> k2 -> k) (m :: k3 -> k2) (f :: k3 -> k1) (a :: k3) = c (f a) (m a) Source #

type Coalgebra (c :: k1 -> k2 -> k) (f :: k1 -> k2) (a :: k1) = c a (f a) Source #

type CoalgebraM (c :: k1 -> k2 -> k) (m :: k3 -> k2) (f :: k1 -> k3) (a :: k1) = c a (m (f a)) Source #

Note that using a CoalgebraM “directly” is partial (e.g., with anaM). However, ana . Compose can accept a CoalgebraM and produce something like an effectful stream.

class Corecursive (c :: k -> k1 -> Type) (t :: k1) (f :: k -> k1) | t -> f Source #

Coinductive (potentially-infinite) structures that guarantee _productivity_ rather than termination.

Minimal complete definition

ana

Instances

Instances details
Corecursive (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

ana :: Coalgebra (->) f a -> a -> Nu f Source #

Functor f => Corecursive (->) (Cofix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native.Internal

Methods

ana :: Coalgebra (->) f a -> a -> Cofix f Source #

Corecursive (->) (NonEmpty a :: Type) (AndMaybe a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

ana :: Coalgebra (->) (AndMaybe a) a0 -> a0 -> NonEmpty a Source #

Corecursive (->) ([a] :: Type) (XNor a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

ana :: Coalgebra (->) (XNor a) a0 -> a0 -> [a] Source #

Corecursive (->) (Maybe a :: Type) (Const (Maybe a) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

ana :: Coalgebra (->) (Const (Maybe a) :: Type -> Type) a0 -> a0 -> Maybe a Source #

Functor f => Corecursive (->) (Cofree f a :: Type) (EnvT a f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

ana :: Coalgebra (->) (EnvT a f) a0 -> a0 -> Cofree f a Source #

Functor f => Corecursive (->) (Free f a :: Type) (FreeF f a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

ana :: Coalgebra (->) (FreeF f a) a0 -> a0 -> Free f a Source #

Corecursive (->) (Either a b :: Type) (Const (Either a b) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

ana :: Coalgebra (->) (Const (Either a b) :: Type -> Type) a0 -> a0 -> Either a b Source #

type DistributiveLaw (c :: k1 -> k1 -> k) (f :: k1 -> k1) (g :: k1 -> k1) = forall (a :: k1). c (f (g a)) (g (f a)) Source #

There are a number of distributive laws, including sequenceA, distribute, and sequenceL. Yaya also provides others for specific recursion schemes.

type ElgotAlgebra (c :: k1 -> k2 -> k) (w :: k3 -> k1) (f :: k2 -> k3) (a :: k2) = c (w (f a)) a Source #

type ElgotAlgebraM (c :: k1 -> k2 -> k) (m :: k3 -> k2) (w :: k4 -> k1) (f :: k3 -> k4) (a :: k3) = c (w (f a)) (m a) Source #

type ElgotCoalgebra (c :: k1 -> k2 -> k) (m :: k3 -> k2) (f :: k1 -> k3) (a :: k1) = c a (m (f a)) Source #

pattern Embed :: Projectable (->) t f => f t -> t Source #

This pattern is useful when you need to match multiple levels of a pattern functor. It won’t break exhaustiveness checking and, despite being named Embed, only requires Projectable.

>>> case 3 :: Natural of {x@(Embed y) -> (x, y)}
(3,Just 2)
>>> case project [1, 2, 3] of {Both x (Embed (Both y z)) -> (x, y, z)}
(1,2,[3])

pattern Project :: Steppable (->) t f => t -> f t Source #

This pattern is useful when you need to match the projection of a structure that has nicer embedded syntax, or if you’re only going to call embed on the extracted values anyway. It won’t break exhaustiveness checking.

>>> case project (3 :: Natural) of {x@(Project y) -> (x, y)}
(Just 2,3)
>>> case project [1, 2, 3] of {x@(Project [1, 2, 3]) -> x}
Both 1 [2,3]

type GAlgebra (c :: k1 -> k2 -> k) (w :: k2 -> k3) (f :: k3 -> k1) (a :: k2) = c (f (w a)) a Source #

type GAlgebraM (c :: k1 -> k2 -> k) (m :: k3 -> k2) (w :: k3 -> k4) (f :: k4 -> k1) (a :: k3) = c (f (w a)) (m a) Source #

type GCoalgebra (c :: k1 -> k2 -> k) (m :: k1 -> k3) (f :: k3 -> k2) (a :: k1) = c a (f (m a)) Source #

type GCoalgebraM (c :: k1 -> k2 -> k) (m :: k3 -> k2) (n :: k1 -> k4) (f :: k4 -> k3) (a :: k1) = c a (m (f (n a))) Source #

data Mu (f :: Type -> Type) Source #

A fixed-point operator for inductive / finite data structures.

NB: This is only guaranteed to be finite when f a is strict in a (having strict functors won't prevent Nu from being lazy). Using -XStrictData can help with this a lot.

Instances

Instances details
DFunctor Mu Source # 
Instance details

Defined in Yaya.Fold

Methods

dmap :: (forall x. f x -> g x) -> Mu f -> Mu g Source #

Functor f => Projectable (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) f (Mu f) Source #

Recursive (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

cata :: Algebra (->) f a -> Mu f -> a Source #

Functor f => Steppable (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) f (Mu f) Source #

Monoid (Mu (XNor a)) Source # 
Instance details

Defined in Yaya.Applied

Methods

mempty :: Mu (XNor a) #

mappend :: Mu (XNor a) -> Mu (XNor a) -> Mu (XNor a) #

mconcat :: [Mu (XNor a)] -> Mu (XNor a) #

Semigroup (Mu (XNor a)) Source # 
Instance details

Defined in Yaya.Applied

Methods

(<>) :: Mu (XNor a) -> Mu (XNor a) -> Mu (XNor a) #

sconcat :: NonEmpty (Mu (XNor a)) -> Mu (XNor a) #

stimes :: Integral b => b -> Mu (XNor a) -> Mu (XNor a) #

(Functor f, Read1 f) => Read (Mu f) Source #

Since: 0.6.1.0

Instance details

Defined in Yaya.Fold

Show1 f => Show (Mu f) Source # 
Instance details

Defined in Yaya.Fold

Methods

showsPrec :: Int -> Mu f -> ShowS #

show :: Mu f -> String #

showList :: [Mu f] -> ShowS #

(Functor f, Foldable f, Eq1 f) => Eq (Mu f) Source # 
Instance details

Defined in Yaya.Fold

Methods

(==) :: Mu f -> Mu f -> Bool #

(/=) :: Mu f -> Mu f -> Bool #

(Functor f, Foldable f, Ord1 f) => Ord (Mu f) Source #

Since: 0.6.1.0

Instance details

Defined in Yaya.Fold

Methods

compare :: 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 #

data Nu (f :: Type -> Type) Source #

A fixed-point operator for coinductive / potentially-infinite data structures.

Instances

Instances details
DFunctor Nu Source # 
Instance details

Defined in Yaya.Fold

Methods

dmap :: (forall x. f x -> g x) -> Nu f -> Nu g Source #

Corecursive (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

ana :: Coalgebra (->) f a -> a -> Nu f Source #

Functor f => Projectable (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) f (Nu f) Source #

Functor f => Steppable (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) f (Nu f) Source #

IsList (Nu (XNor a)) Source #

This instance is safe, since both structures are lazy.

Instance details

Defined in Yaya.Applied

Associated Types

type Item (Nu (XNor a)) 
Instance details

Defined in Yaya.Applied

type Item (Nu (XNor a)) = a

Methods

fromList :: [Item (Nu (XNor a))] -> Nu (XNor a) #

fromListN :: Int -> [Item (Nu (XNor a))] -> Nu (XNor a) #

toList :: Nu (XNor a) -> [Item (Nu (XNor a))] #

(Functor f, Read1 f) => Read (Nu f) Source #

Since: 0.6.1.0

Instance details

Defined in Yaya.Fold

type Item (Nu (XNor a)) Source # 
Instance details

Defined in Yaya.Applied

type Item (Nu (XNor a)) = a

class Projectable (c :: k -> k1 -> Type) (t :: k) (f :: k -> k1) | t -> f Source #

This type class is lawless on its own, but there exist types that can’t implement the corresponding embed operation. Laws are induced by implementing either Steppable (which extends this) or Corecursive (which doesn’t).

Minimal complete definition

project

Instances

Instances details
Projectable (->) Void Identity Source # 
Instance details

Defined in Yaya.Fold

Projectable (->) Natural Maybe Source # 
Instance details

Defined in Yaya.Fold

Functor f => Projectable (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) f (Mu f) Source #

Functor f => Projectable (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) f (Nu f) Source #

Projectable (->) (Fix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

project :: Coalgebra (->) f (Fix f) Source #

Projectable (->) (Cofix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native.Internal

Methods

project :: Coalgebra (->) f (Cofix f) Source #

Projectable (->) (NonEmpty a :: Type) (AndMaybe a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (AndMaybe a) (NonEmpty a) Source #

Projectable (->) ([a] :: Type) (XNor a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (XNor a) [a] Source #

Projectable (->) (Maybe a :: Type) (Const (Maybe a) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (Const (Maybe a) :: Type -> Type) (Maybe a) Source #

Projectable (->) (Cofree f a :: Type) (EnvT a f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (EnvT a f) (Cofree f a) Source #

Projectable (->) (Free f a :: Type) (FreeF f a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (FreeF f a) (Free f a) Source #

Projectable (->) (Either a b :: Type) (Const (Either a b) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

project :: Coalgebra (->) (Const (Either a b) :: Type -> Type) (Either a b) Source #

class Recursive (c :: k -> k1 -> Type) (t :: k) (f :: k1 -> k) | t -> f Source #

Inductive structures that can be reasoned about in the way we usually do – with pattern matching.

Minimal complete definition

cata

Instances

Instances details
Recursive (->) Void Identity Source # 
Instance details

Defined in Yaya.Fold

Methods

cata :: Algebra (->) Identity a -> Void -> a Source #

Recursive (->) Natural Maybe Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

cata :: Algebra (->) Maybe a -> Natural -> a Source #

Recursive (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

cata :: Algebra (->) f a -> Mu f -> a Source #

Functor f => Recursive (->) (Fix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

cata :: Algebra (->) f a -> Fix f -> a Source #

Recursive (->) (Maybe a :: Type) (Const (Maybe a) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

cata :: Algebra (->) (Const (Maybe a) :: Type -> Type) a0 -> Maybe a -> a0 Source #

Recursive (->) (Either a b :: Type) (Const (Either a b) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

cata :: Algebra (->) (Const (Either a b) :: Type -> Type) a0 -> Either a b -> a0 Source #

class Projectable c t f => Steppable (c :: k -> k -> Type) (t :: k) (f :: k -> k) | t -> f Source #

Structures you can walk through step-by-step.

Minimal complete definition

embed

Instances

Instances details
Steppable (->) Void Identity Source # 
Instance details

Defined in Yaya.Fold

Steppable (->) Natural Maybe Source # 
Instance details

Defined in Yaya.Fold

Functor f => Steppable (->) (Mu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) f (Mu f) Source #

Functor f => Steppable (->) (Nu f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) f (Nu f) Source #

Steppable (->) (Fix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native

Methods

embed :: Algebra (->) f (Fix f) Source #

Steppable (->) (Cofix f :: Type) (f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold.Native.Internal

Methods

embed :: Algebra (->) f (Cofix f) Source #

Steppable (->) (NonEmpty a :: Type) (AndMaybe a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (AndMaybe a) (NonEmpty a) Source #

Steppable (->) ([a] :: Type) (XNor a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (XNor a) [a] Source #

Steppable (->) (Maybe a :: Type) (Const (Maybe a) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (Const (Maybe a) :: Type -> Type) (Maybe a) Source #

Steppable (->) (Cofree f a :: Type) (EnvT a f :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (EnvT a f) (Cofree f a) Source #

Steppable (->) (Free f a :: Type) (FreeF f a :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (FreeF f a) (Free f a) Source #

Steppable (->) (Either a b :: Type) (Const (Either a b) :: Type -> Type) Source # 
Instance details

Defined in Yaya.Fold

Methods

embed :: Algebra (->) (Const (Either a b) :: Type -> Type) (Either a b) Source #

ana :: forall (a :: k). Corecursive c t f => Coalgebra c f a -> c a t Source #

attributeAlgebra :: (Steppable (->) t (EnvT a f), Functor f) => Algebra (->) f a -> Algebra (->) f t Source #

Converts an Algebra to one that annotates the tree with the result for each node.

attributeCoalgebra :: Coalgebra (->) f a -> Coalgebra (->) (EnvT a f) a Source #

Converts a Coalgebra to one that annotates the tree with the seed that generated each node.

cata :: forall (a :: k1). Recursive c t f => Algebra c f a -> c t a Source #

cata2 :: forall t (f :: Type -> Type) u (g :: Type -> Type) a. (Recursive (->) t f, Projectable (->) u g) => Algebra (->) (Day f g) a -> t -> u -> a Source #

By analogy with liftA2 (which also relies on Day, at least conceptually).

colambek :: (Projectable (->) t f, Corecursive (->) t f, Functor f) => Algebra (->) f t Source #

constAna :: Coalgebra (->) (Const b :: Type -> Type) a -> a -> b Source #

constCata :: Algebra (->) (Const b :: Type -> Type) a -> b -> a Source #

constEmbed :: Algebra (->) (Const a :: Type -> Type) a Source #

distCofreeT :: forall t f a (h :: Type -> Type). (Corecursive (->) (t (f a)) (EnvT (f a) h), Projectable (->) (t a) (EnvT a h), Functor f) => DistributiveLaw (->) f h -> f (t a) -> t (f a) Source #

distEnvT Source #

Arguments

:: forall f a b (w :: Type -> Type) c. Functor f 
=> (f a -> b)

NB: To be a true DistributiveLaw, this must be an Algebra (->) f a, but this more general version is useful in certain cases (like distCofreeT).

-> DistributiveLaw (->) f w 
-> f (EnvT a w c) 
-> EnvT b w (f c) 

distIdentity :: forall (f :: Type -> Type). Functor f => DistributiveLaw (->) f Identity Source #

A less-constrained distribute for Identity.

distTuple :: Functor f => Algebra (->) f a -> DistributiveLaw (->) f (Pair a) Source #

elgotAna :: (Corecursive (->) t f, Functor f, Monad m) => DistributiveLaw (->) m f -> ElgotCoalgebra (->) m f a -> a -> t Source #

elgotCata :: (Recursive (->) t f, Functor f, Comonad w) => DistributiveLaw (->) f w -> ElgotAlgebra (->) w f a -> t -> a Source #

elgotCataM :: (Monad m, Recursive (->) t f, Traversable f, Comonad w, Traversable w) => DistributiveLaw (->) f w -> ElgotAlgebraM (->) m w f a -> t -> m a Source #

embed :: Steppable c t f => Algebra c f t Source #

ezygoM :: (Monad m, Recursive (->) t f, Traversable f) => AlgebraM (->) m f b -> ElgotAlgebraM (->) m (Pair b) f a -> t -> m a Source #

gana :: (Corecursive (->) t f, Functor f, Monad m) => DistributiveLaw (->) m f -> GCoalgebra (->) m f a -> a -> t Source #

gcata :: (Recursive (->) t f, Functor f, Comonad w) => DistributiveLaw (->) f w -> GAlgebra (->) w f a -> t -> a Source #

gcataM :: (Monad m, Recursive (->) t f, Traversable f, Comonad w, Traversable w) => DistributiveLaw (->) f w -> GAlgebraM (->) m w f a -> t -> m a Source #

ignoringAttribute :: Algebra (->) f a -> Algebra (->) (EnvT b f) a Source #

This is just a more obvious name for composing lowerEnvT with your algebra directly.

lambek :: (Steppable (->) t f, Recursive (->) t f, Functor f) => Coalgebra (->) f t Source #

lowerAlgebra :: (Functor f, Comonad w) => DistributiveLaw (->) f w -> GAlgebra (->) w f a -> Algebra (->) f (w a) Source #

Makes it possible to provide a GAlgebra to cata.

lowerAlgebraM :: (Applicative m, Traversable f, Comonad w, Traversable w) => DistributiveLaw (->) f w -> GAlgebraM (->) m w f a -> AlgebraM (->) m f (w a) Source #

Makes it possible to provide a GAlgebraM to cataM.

lowerCoalgebra :: (Functor f, Monad m) => DistributiveLaw (->) m f -> GCoalgebra (->) m f a -> Coalgebra (->) f (m a) Source #

Makes it possible to provide a GCoalgebra to ana.

lowerCoalgebraM :: (Applicative m, Traversable f, Monad n, Traversable n) => DistributiveLaw (->) n f -> GCoalgebraM (->) m n f a -> CoalgebraM (->) m f (n a) Source #

Makes it possible to provide a GCoalgebraM to anaM.

lowerDay :: forall t (g :: Type -> Type) f a. Projectable (->) t g => Algebra (->) (Day f g) a -> Algebra (->) f (t -> a) Source #

Algebras over Day convolution are convenient for binary operations, but aren’t directly handleable by cata.

recursiveCompare :: forall t (f :: Type -> Type) u. (Recursive (->) t f, Steppable (->) u f, Functor f, Foldable f, Ord1 f) => t -> u -> Ordering Source #

An implementation of == for any Recursive instance. Note that this is actually more general than Ord’s compare, as it can compare between different fixed-point representations of the same functor.

NB: Use recursiveCompare' if you need to use a custom comparator for f.

Since: 0.6.1.0

recursiveCompare' :: (Recursive (->) t f, Steppable (->) u f, Functor f, Foldable f) => (f () -> f () -> Ordering) -> t -> u -> Ordering Source #

Like recursiveCompare, but allows you to provide a custom comparator for f.

Since: 0.6.1.0

recursiveEq :: forall t (f :: Type -> Type) u. (Recursive (->) t f, Steppable (->) u f, Functor f, Foldable f, Eq1 f) => t -> u -> Bool Source #

An implementation of == for any Recursive instance. Note that this is actually more general than Eq’s ==, as it can compare between different fixed-point representations of the same functor.

NB: Use recursiveEq' if you need to use a custom comparator for f.

recursiveEq' :: (Recursive (->) t f, Steppable (->) u f, Functor f, Foldable f) => (f () -> f () -> Bool) -> t -> u -> Bool Source #

Like recursiveEq, but allows you to provide a custom comparator for f.

Since: 0.6.1.0

recursiveShowsPrec :: forall t (f :: Type -> Type). (Recursive (->) t f, Show1 f) => Int -> t -> ShowS Source #

An implementation of showsPrec for any Recursive instance.

recursiveShowsPrec' :: Recursive (->) t f => Algebra (->) f (Int -> ShowS) -> Int -> t -> ShowS Source #

Like recursiveShowsPrec, but allows you to provide a custom display function for f.

Since: 0.6.1.0

seqEither :: Functor f => Coalgebra (->) f a -> DistributiveLaw (->) (Either a) f Source #

seqFreeF Source #

Arguments

:: forall f a b (m :: Type -> Type) c. Functor f 
=> (a -> f b)

NB: To be a true DistributiveLaw, this must be a Coalgebra (->) f a, but this more general version is useful in certain cases (like seqFreeT).

-> DistributiveLaw (->) m f 
-> FreeF m a (f c) 
-> f (FreeF m b c) 

seqFreeT :: forall t f a (h :: Type -> Type). (Recursive (->) (t (f a)) (FreeF h (f a)), Steppable (->) (t a) (FreeF h a), Functor f) => DistributiveLaw (->) h f -> t (f a) -> f (t a) Source #

seqIdentity :: forall (f :: Type -> Type). Functor f => DistributiveLaw (->) Identity f Source #

A less-constrained sequenceA for Identity.

steppableReadPrec :: forall t (f :: Type -> Type). (Steppable (->) t f, Read1 f) => ReadPrec t Source #

An implementation of readPrec for any Steppable instance.

NB: Use steppableReadPrec' if you need to use a custom parsing function for f.

NB: This only requires Steppable, but the inverse operation is recursiveShowsPrec, which requires Recursive instead.

Since: 0.6.1.0

steppableReadPrec' :: Steppable (->) t f => (ReadPrec t -> ReadPrec [t] -> ReadPrec (f t)) -> ReadPrec t Source #

Like steppableReadPrec, but allows you to provide a custom display function for f.

Since: 0.6.1.0

unFree :: forall t (f :: Type -> Type). Steppable (->) t f => Algebra (->) (FreeF f t) t Source #

It is somewhat common to have a natural transformation that looks like η :: forall a. f a -> Free g a. This maps naturally to a GCoalgebra (to pass to apo) with η . project, but the desired Algebra is more likely to be cata unFree . η than embed . η. See yaya-streams for some examples of this.

zipAlgebraMs :: (Applicative m, Functor f) => AlgebraM (->) m f a -> AlgebraM (->) m f b -> AlgebraM (->) m f (Pair a b) Source #

Combines two AlgebraMs with different carriers into a single tupled AlgebraM.

zipAlgebras :: Functor f => Algebra (->) f a -> Algebra (->) f b -> Algebra (->) f (Pair a b) Source #

Combines two Algebras with different carriers into a single tupled Algebra.