Book contents
- Frontmatter
- Contents
- List of Figures
- Preface
- 1 The Key Idea
- 2 Approaches to Parallel Software Development
- 3 Architectural Background
- 4 Models and Their Properties
- 5 The Categorical Data Type of Lists
- 6 Software Development Using Lists
- 7 Other Operations on Lists
- 8 A Cost Calculus for Lists
- 9 Building Categorical Data Types
- 10 Lists, Bags, and Finite Sets
- 11 Trees
- 12 Arrays
- 13 Graphs
- 14 Conclusions
- A C++ Library for Lists
- B Historical Background
- References
- Index
9 - Building Categorical Data Types
Published online by Cambridge University Press: 25 October 2009
- Frontmatter
- Contents
- List of Figures
- Preface
- 1 The Key Idea
- 2 Approaches to Parallel Software Development
- 3 Architectural Background
- 4 Models and Their Properties
- 5 The Categorical Data Type of Lists
- 6 Software Development Using Lists
- 7 Other Operations on Lists
- 8 A Cost Calculus for Lists
- 9 Building Categorical Data Types
- 10 Lists, Bags, and Finite Sets
- 11 Trees
- 12 Arrays
- 13 Graphs
- 14 Conclusions
- A C++ Library for Lists
- B Historical Background
- References
- Index
Summary
We have shown how to build categorical data types for the simple type of concatenation lists. In this chapter we show the data type construction in its most general setting. While there is some overhead to understanding the construction in this more general setting, the generality is needed to build much more complex types. We illustrate this in subsequent chapters by building types such as trees, arrays, and graphs.
More category theory background is assumed in this chapter. Suitable references are [127,158].
Categorical Data Type Construction
The construction of a categorical data type is divided into four stages:
The choice of an underlying category of basic types and computations on them. This is usually the category Type, but other possibilities will certainly be of interest.
The choice of an endofunctor, T, on this underlying category. The functor is chosen so that its effect on the still-hypothetical constructed type is to unpack it into its components. Components are chosen by considering the type signatures of constructors that seem suitable for the desired type. When this endofunctor is polynomial it has a fixed point; and this fixed point is defined to be the constructed type.
The construction of a category of T-algebras, T-AIg, whose objects are algebras of the new type and their algebraic relatives, and whose arrows are homomorphisms on the new type. The constructed type algebra (the free type algebra) is the initial object in this category. The unique arrows from it to other algebras are catamorphisms.
[…]
- Type
- Chapter
- Information
- Foundations of Parallel Programming , pp. 115 - 128Publisher: Cambridge University PressPrint publication year: 1994