## When Is a Container a Comonad?

Citations: | 2 - 2 self |

### BibTeX

@MISC{Ahman_whenis,

author = {Danel Ahman and James Chapman and Tarmo Uustalu},

title = {When Is a Container a Comonad?},

year = {}

}

### OpenURL

### Abstract

Abstract. Abbott, Altenkirch, Ghani and others have taught us that many parameterized datatypes (set functors) can be usefully analyzed via container representations in terms of a set of shapes and a set of positions in each shape. This paper builds on the observation that datatypes often carry additional structure that containers alone do not account for. We introduce directed containers to capture the common situation where every position in a datastructure determines another datastructure, informally, the sub-datastructure rooted by that position. Some natural examples are non-empty lists and node-labelled trees, and datastructures with a designated position (zippers). While containers denote set functors via a fully-faithful functor, directed containers interpret fully-faithfully into comonads. But more is true: every comonad whose underlying functor is a container is represented by a directed container. In fact, directed containers are the same as containers that are comonads. We also describe some constructions of directed containers. We have formalized our development in the dependently typed programming language Agda. 1

### Citations

167 | Towards a Practical Programming Language Based on Dependent Type Theory
- Norell
- 2007
(Show Context)
Citation Context ...ume that the reader knows about comonads, monoidal categories, monoidal functors and comonoids. In our mathematics, we use syntax similar to the dependently typed functional programming language Agda =-=[18]-=-. If some function argument will be derivable in most contexts, we mark it as implicit by enclosing it/its type in braces in the function’s type declaration and either give this argument in braces or ... |

92 | The zipper
- Huet
- 1997
(Show Context)
Citation Context ...ture on the functor ∂�C� c × Id where ∂F denotes the derivative of the functor F . Zippers. Inductive (tree-like) datatypes with a designated focus position are isomorphic to the zipper types of Huet =-=[13]-=-. A zipper datastructure encodes a tree with a focus as a pair of a context and a tree. The tree is the subtree of the global tree rooted by the focus and the context encodes the rest of the global tr... |

79 |
Foncteurs analytiques et espèces de structures
- Joyal
- 1985
(Show Context)
Citation Context ...r a Comonad? 87 polynomial functors as appearing in the works of Dybjer [8], Moerdijk and Palmgren [16], Gambino and Hyland [9], Kock [15]. Girard’s normal functors [11] and Joyal’s analytic functors =-=[14]-=- functors are similar to containers resp. quotient containers, but only allow for finitely many positions in a shape. Gambino and Kock [10] treat polynomial monads. Abbott, Altenkirch, Ghani and McBri... |

61 |
Containers - constructing strictly positive types, Theoretical Computer Science 342 (2005) 3–27, applied Semantics: Selected Topics
- Abott, Altenkirch, et al.
(Show Context)
Citation Context ...e constructions of directed containers. We have formalized our development in the dependently typed programming language Agda. 1 Introduction Containers, as introduced by Abbott, Altenkirch and Ghani =-=[1]-=- are a neat representation for a wide class of parameterized datatypes (set functors) in terms of a set of shapes and a set of positions in each shape. They cover lists, colists, streams, various kind... |

40 | Categories of containers
- Abbott, Altenkirch, et al.
- 2003
(Show Context)
Citation Context ...lso recall some76 D. Ahman, J. Chapman, and T. Uustalu basic constructions of containers. For proofs of the propositions in this section and further information, we refer the reader to Abbott et al. =-=[1, 4]-=-. 2.1 Containers Containers are a form of “syntax” for datatypes. A container S ⊳ P is given by asetS : Set of shapes and a shape-indexed family P : S → Set of positions. Intuitively, shapes are “temp... |

37 | Wellfounded trees in categories
- Moerdijk, Palmgren
- 2000
(Show Context)
Citation Context ...Containers can be used as a “syntax” for programming with these datatypes and reasoning about them, as can the strictly positive datatypes and polynomial functors of Dybjer [8], Moerdijk and Palmgren =-=[16]-=-, Gambino and Hyland [9], and Kock [15]. The theory of this class of datatypes is elegant, as they are well-behaved in many respects. This paper proceeds from the observation that datatypes often carr... |

27 | Monads and Comonads in Intensional Semantics
- Brookes, Stone
- 1993
(Show Context)
Citation Context ...k [10] treat polynomial monads. Abbott, Altenkirch, Ghani and McBride [3] have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva =-=[6]-=- and later Uustalu with coauthors [20, 21, 12, 7] have used comonads to analyze notions of context-dependent computation such as dataflow computation, attribute grammars, tree transduction and cellula... |

25 | Well-founded trees and dependent polynomial functors
- Gambino, Hyland
- 2004
(Show Context)
Citation Context ... a “syntax” for programming with these datatypes and reasoning about them, as can the strictly positive datatypes and polynomial functors of Dybjer [8], Moerdijk and Palmgren [16], Gambino and Hyland =-=[9]-=-, and Kock [15]. The theory of this class of datatypes is elegant, as they are well-behaved in many respects. This paper proceeds from the observation that datatypes often carry additional structure t... |

23 | Indexed containers
- Morris, Altenkirch
- 2009
(Show Context)
Citation Context ...iners as developed by Abbott, Altenkirch and Ghani [1, 4] to analyze strictly positive datatypes. Some generalizations of the concept of containers are the indexed containers of Altenkirch and Morris =-=[5, 17]-=- and the quotient containers of Abbott et al. [2]. In our work we look at a specialization of containers rather than a generalization. Simple/indexed containers are intimately related to strongly posi... |

18 |
Constructing Universes for Generic Programming
- Morris
- 2007
(Show Context)
Citation Context ...iners as developed by Abbott, Altenkirch and Ghani [1, 4] to analyze strictly positive datatypes. Some generalizations of the concept of containers are the indexed containers of Altenkirch and Morris =-=[5, 17]-=- and the quotient containers of Abbott et al. [2]. In our work we look at a specialization of containers rather than a generalization. Simple/indexed containers are intimately related to strongly posi... |

18 | V.: The Essence of Dataflow Programming
- Uustalu, Vene
(Show Context)
Citation Context ...t, Altenkirch, Ghani and McBride [3] have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva [6] and later Uustalu with coauthors =-=[20, 21, 12, 7]-=- have used comonads to analyze notions of context-dependent computation such as dataflow computation, attribute grammars, tree transduction and cellular automata. Uustalu and Vene’s [22] observation o... |

15 | Representing inductively defined sets by wellorderings in Martin-Löf’s type theory
- Dybjer
- 1997
(Show Context)
Citation Context ...rious kinds of trees, etc. Containers can be used as a “syntax” for programming with these datatypes and reasoning about them, as can the strictly positive datatypes and polynomial functors of Dybjer =-=[8]-=-, Moerdijk and Palmgren [16], Gambino and Hyland [9], and Kock [15]. The theory of this class of datatypes is elegant, as they are well-behaved in many respects. This paper proceeds from the observati... |

15 |
Normal functors, power series and lambda-calculus
- Girard
- 1986
(Show Context)
Citation Context ...simple/dependentWhen Is a Container a Comonad? 87 polynomial functors as appearing in the works of Dybjer [8], Moerdijk and Palmgren [16], Gambino and Hyland [9], Kock [15]. Girard’s normal functors =-=[11]-=- and Joyal’s analytic functors [14] functors are similar to containers resp. quotient containers, but only allow for finitely many positions in a shape. Gambino and Kock [10] treat polynomial monads. ... |

12 | Constructing Polymorphic Programs with Quotient Types
- Abbott, Altenkirch, et al.
- 2004
(Show Context)
Citation Context ..., 4] to analyze strictly positive datatypes. Some generalizations of the concept of containers are the indexed containers of Altenkirch and Morris [5, 17] and the quotient containers of Abbott et al. =-=[2]-=-. In our work we look at a specialization of containers rather than a generalization. Simple/indexed containers are intimately related to strongly positive datatypes/families and simple/dependentWhen... |

9 |
Comonadic notions of computation, in
- Uustalu, Vene
(Show Context)
Citation Context ...rs [20, 21, 12, 7] have used comonads to analyze notions of context-dependent computation such as dataflow computation, attribute grammars, tree transduction and cellular automata. Uustalu and Vene’s =-=[22]-=- observation of a connection between bottom-up tree relabellings and containers with extra structure started our investigation into directed containers. 7 Conclusions and Future Work We introduced dir... |

7 | D for data: Differentiating data structures
- Abbott, Altenkirch, et al.
- 2004
(Show Context)
Citation Context ...nctors are similar to containers resp. quotient containers, but only allow for finitely many positions in a shape. Gambino and Kock [10] treat polynomial monads. Abbott, Altenkirch, Ghani and McBride =-=[3]-=- have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva [6] and later Uustalu with coauthors [20, 21, 12, 7] have used comonads t... |

7 |
C.: Proving properties about lists using containers
- Prince, Ghani, et al.
- 2008
(Show Context)
Citation Context ...n (s +1) arets= s ÷ 2andq {s} p = p ∗ 2. For reversal of non-empty lists, they are t : Nat → Nat and q : Π{s : Nat}. Fin (s + 1) → Fin (s + 1) defined by ts= s and q {s} p = s − p. (See Prince et al. =-=[19]-=- for more similar examples.) The identity morphism id c {C} on a container C = S ⊳ P is defined by id c = id {S}⊳λ{s}. id {P s}. Thecomposition h ◦c h ′ of container morphisms h = t⊳q and h ′ = t ′ ⊳ ... |

4 |
Polynomial functors and trees
- Kock
(Show Context)
Citation Context ...r programming with these datatypes and reasoning about them, as can the strictly positive datatypes and polynomial functors of Dybjer [8], Moerdijk and Palmgren [16], Gambino and Hyland [9], and Kock =-=[15]-=-. The theory of this class of datatypes is elegant, as they are well-behaved in many respects. This paper proceeds from the observation that datatypes often carry additional structure that containers ... |

2 | A Categorical Outlook on Cellular Automata. Arxiv preprint arXiv:1012.1220
- Capobianco, Uustalu
- 2010
(Show Context)
Citation Context ...t, Altenkirch, Ghani and McBride [3] have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva [6] and later Uustalu with coauthors =-=[20, 21, 12, 7]-=- have used comonads to analyze notions of context-dependent computation such as dataflow computation, attribute grammars, tree transduction and cellular automata. Uustalu and Vene’s [22] observation o... |

2 | Polynomial functors and polynomial monads
- Gambino, Kock
- 2010
(Show Context)
Citation Context ... Girard’s normal functors [11] and Joyal’s analytic functors [14] functors are similar to containers resp. quotient containers, but only allow for finitely many positions in a shape. Gambino and Kock =-=[10]-=- treat polynomial monads. Abbott, Altenkirch, Ghani and McBride [3] have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva [6] an... |

2 |
T.: Categorical views on computations on trees
- Hasuo, Jacobs, et al.
- 2007
(Show Context)
Citation Context ...t, Altenkirch, Ghani and McBride [3] have investigated derivatives of datatypes that provide a systematic way to explain Huet’s zipper type [13]. Brookes and Geva [6] and later Uustalu with coauthors =-=[20, 21, 12, 7]-=- have used comonads to analyze notions of context-dependent computation such as dataflow computation, attribute grammars, tree transduction and cellular automata. Uustalu and Vene’s [22] observation o... |

1 |
V.: Attribute evaluation is comonadic
- Uustalu, Vene
- 2007
(Show Context)
Citation Context |