Unison.Util.Recursion
type Algebra f a = f a -> a Source #
class Recursive t f | t -> f where Source #
Minimal complete definition
embed, (cata | project)
Methods
cata :: Algebra f a -> t -> a Source #
default cata :: Functor f => (f a -> a) -> t -> a Source #
project :: t -> f t Source #
default project :: Functor f => t -> f t Source #
embed :: f t -> t Source #
Defined in Unison.Util.Recursion
cata :: Algebra f a -> Fix f -> a Source #
project :: Fix f -> f (Fix f) Source #
embed :: f (Fix f) -> Fix f Source #
NB: Cofree from “free” is lazy, so this instance is technically partial.
Cofree
cata :: Algebra (CofreeF f a) a0 -> Cofree f a -> a0 Source #
project :: Cofree f a -> CofreeF f a (Cofree f a) Source #
embed :: CofreeF f a (Cofree f a) -> Cofree f a Source #
cataM :: (Recursive t f, Traversable f, Monad m) => (f a -> m a) -> t -> m a Source #
para :: (Recursive t f, Functor f) => (f (t, a) -> a) -> t -> a Source #
newtype Fix f Source #
Constructors
showsPrec :: Int -> Fix f -> ShowS #
show :: Fix f -> String #
showList :: [Fix f] -> ShowS #
(==) :: Fix f -> Fix f -> Bool #
(/=) :: Fix f -> Fix f -> Bool #
compare :: 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 #