*** Welcome to piglix ***

Catamorphism


In category theory, the concept of catamorphism (from the Greek: "downwards" and "form, shape") denotes the unique homomorphism from an initial algebra into some other algebra.

In functional programming, catamorphisms provide generalizations of folds of lists to arbitrary algebraic data types, which can be described as initial algebras. The dual concept is that of anamorphism that generalize unfolds. A hylomorphism is the composition of an anamorphism followed by a catamorphism.

Consider an initial F-algebra (A, in) for some endofunctor F of some category into itself. Here in is a morphism from FA to A. Since it is initial, we know that whenever (X, f) is another F-algebra, i.e. a morphism f from FX to X, there is a unique homomorphism h from (A, in) to (X, f). By the definition of the category of F-algebras, this h corresponds to a morphism from A to X, conventionally also denoted h, such that . In the context of F-algebras, the uniquely specified morphism from the initial object is denoted by cata f and hence characterized by the following relationship:


...
Wikipedia

...