language-icon Old Web
English
Sign In

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 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 h ∘ i n = f ∘ F h {displaystyle hcirc in=fcirc Fh} . 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: Another notation found in the literature is ( | f | ) {displaystyle (!|f|!)} . The open brackets used are known as banana brackets, after which catamorphisms are sometimes referred to as bananas, as mentioned in Meijer 1991. One of the first publications to introduce the notion of a catamorphism in the context of programming was the paper “Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire”, by Erik Meijer et al., which was in the context of the Squiggol formalism.The general categorical definition was given by Grant Malcolm. We give a series of examples, and then a more global approach to catamorphisms, in the Haskell programming language.

[ "Recursion", "Abstraction", "Data type", "Functor", "Functional programming" ]
Parent Topic
Child Topic
    No Parent Topic