## Shapely Types and Shape Polymorphism (1994)

Venue: | Programming Languages and Systems - ESOP '94: 5th European Symposium on Programming |

Citations: | 35 - 6 self |

### BibTeX

@INPROCEEDINGS{Jay94shapelytypes,

author = {C. Barry Jay and J.R.B. Cockett},

title = {Shapely Types and Shape Polymorphism},

booktitle = {Programming Languages and Systems - ESOP '94: 5th European Symposium on Programming},

year = {1994},

pages = {302--316},

publisher = {Springer Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

. Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. They include both arrays and the usual algebraic types (of trees, graphs, etc.), and are closed under the formation of initial algebras. 1 Introduction Consider the operation map which applies a function to each element of a list. In existing functional languages, its type is (ff!fi)!ff list!fi list where ff and fi may range over any types. This data polymorphism allows the data (ff and fi) to vary, but uses a fixed shape, list. Shape polymorphism fixes the data, but allows the shape to vary, so that, for types A and B, instances of map include (A!B)!A tree!B tree and (A!B)!A matrix!B matrix In each case map(f) applies f to the data (the leaves or entries), while leaving the shape fi...

### Citations

1347 | Imperative functional programming
- Jones, Wadler
- 1993
(Show Context)
Citation Context ... 1+(A\ThetaLA)!LA is an isomorphism, which expresses LA as a coproduct. From these primitives we can construct the usual family of list operations, whose notation is a mixture of the list notation of =-=[BW88]-=- and categorical notation for monads: Lf : LA!LB is map(f) for f : A!B j : A!LA makes singleton lists @ : LA\ThetaLA!LA is append snoc : LA\ThetaA!LA is cons on the tail of the lists: L 2 A!LA flatten... |

175 |
The category-theoretic solution of recursive domain equations
- Smyth, Plotkin
(Show Context)
Citation Context ... 0 C h ? hnil; ji -L\Omega \ThetaLC ? id\ThetaLh Fig. 1. Factorisation of hC 7.2 The General Case A functor F : C m \ThetaC n !C n can be used to represent a system of (parametrised) domain equations =-=[SP82]-=-, whose solution is can be found by constructing, for each object A in C m , an initial algebra ff A : F (A; F y A)!F y A for the functor F (A; \Gamma). If such always exist, then F y extends to a fun... |

98 |
Introduction to extensive and distributive categories
- Carboni, Lack, et al.
- 1993
(Show Context)
Citation Context ...92]) at this stage would impose an unwelcome burden so, to simplify slightly, we will assume that we have all pullbacks, and work in a finitely complete, distributive category (or lextensive category =-=[CLW93]-=-) which has all list objects, i.e. a locos [Coc90]. Being extensive is equivalent to requiring that all coproduct diagrams have disjoint (monomorphic) inclusions, and are stable under pulling back. Ex... |

50 |
Strong categorical datatypes I
- Cockett, Spencer
(Show Context)
Citation Context ...ionsA;B : FA\ThetaB!F (A\ThetaB) which satisfies the usual associativity and unicity axioms. More generally, a strength for F : C m !C n is given by a strength for each of its projections onto C. See =-=[CS92]-=- for an account of the connections between strength and fibrations. (F;s) is a shapely functor if F is stable (preserves all pullbacks) andsis a strength for it. Then F1 is the object of F -shapes and... |

15 |
List-arithmetic distributive categories: Locoi
- Cockett
- 1990
(Show Context)
Citation Context ...d indeed strengthening) the benefits of typing. These ideas can be understood within a semantics based on sets, or of bottomless c.p.o's, but for generality (and flexibility) are presented in a locos =-=[Coc90]-=-, which provides a minimal setting for working with both lists and pullbacks. In particular, no higher types are assumed (as is shown feasible in the language Charity[CF92]) since they contribute noth... |

10 |
Monads and the Fast Fourier Transform
- Matrices
- 1994
(Show Context)
Citation Context ... and B to A\ThetaB = (A 1 \ThetaB; A 2 \ThetaB; : : : ; An \ThetaB) and has the obvious action on morphisms. 3 Shapely Functors and Transformations The essential ideas of this section can be found in =-=[Jay93a]-=-. A strength for a functor F : C m !C is a natural transformationsA;B : FA\ThetaB!F (A\ThetaB) which satisfies the usual associativity and unicity axioms. More generally, a strength for F : C m !C n i... |

6 | Tail recursion through universal invariants
- Jay
- 1993
(Show Context)
Citation Context ...A!LA is append snoc : LA\ThetaA!LA is cons on the tail of the lists: L 2 A!LA flattens a list of lists g : LA!LB issffi Lg for g : A!LB. Many elementary results about lists in locoses can be found in =-=[Jay93b]-=-. L1 is a natural numbers object N with zero 0 and successor S given by nil and cons respectively. Then j = one and @ = + is addition ands: LN!N is summation. Let Eq be the equality on N . The length ... |

3 |
Deriving the fast fourier transform algorithm by calculation
- Jones
- 1990
(Show Context)
Citation Context ...copies instantiates all entries of the shape to the given value, while square replaces each entry with a copy of the whole. Closely related to map are the pointwise operators introduced by example in =-=[Jon90]-=- and defined in [Jay93a]. These iterate an endomorphism at each entry in a shape. The number of iterations at each entry is determined by a weight on the shape i.e. a morphism F1!FN . Particular shape... |

2 |
A foundation for theories of arrays. Queen's
- Banger, Skillicorn
- 1993
(Show Context)
Citation Context ...) \Pi@ - \PiL m A (wheres= permutes the arguments) induces a shapely transformation F y )\PiL m which shows that F y is a shapely type constructor. uts8 Related and Further Work Banger and Skillicorn =-=[BS93]-=- give a categorical semantics for arrays, which are represented by their dimensions and some unbounded lists. They do not use pullbacks to represent their types, nor is there a general theory of shape... |

2 |
Shapely types and shape polymorphism: Extended version
- Jay, Cockett
- 1994
(Show Context)
Citation Context ... and other types defined by pullbacks, means that the shapely types lie between these algebraic types, and the class of initial algebras for arbitrary functors. Full details of proofs can be found in =-=[JC94]-=-. 2 Locoses The types and operations are modelled by the objects and arrows of a category C. It must have lists (and the underlying products and coproducts required to define them) and enough pullback... |

2 |
Predicate Transformer Semantics, volume 33 of Cambridge Tracts
- Manes
- 1992
(Show Context)
Citation Context ...ve lists (and the underlying products and coproducts required to define them) and enough pullbacks to work with shapes. Specifying such a class of pullbacks (as was done for the Boolean categories of =-=[Man92]-=-) at this stage would impose an unwelcome burden so, to simplify slightly, we will assume that we have all pullbacks, and work in a finitely complete, distributive category (or lextensive category [CL... |

1 |
About charity. University of Calgary preprint
- Cockett, Fukushima
- 1992
(Show Context)
Citation Context ...) are presented in a locos [Coc90], which provides a minimal setting for working with both lists and pullbacks. In particular, no higher types are assumed (as is shown feasible in the language Charity=-=[CF92]-=-) since they contribute nothing to the theory of shape. A calculus of shapely functors and natural transformations is introduced, with the shapely type constructors being those functors which have a s... |