HackerPapers

arXiv:1408.5809cs.PL

When is a container a comonad?

Danel Ahman, James Chapman, Tarmo Uustalu

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

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 data-structure determines another data-structure, informally, the sub-data-structure rooted by that position. Some natural examples are non-empty lists and node-labelled trees, and data-structures 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.

arXiv comments
Journal reference
Logical Methods in Computer Science, Volume 10, Issue 3 (September 3, 2014) lmcs:894
DOI
doi:10.2168/LMCS-10(3:14)2014
Subjects
cs.PLProgramming Languages cs.LOLogic in Computer Science math.CTCategory Theory

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Feb 2024 to Feb 2024.

Comments linking this paper, per year.

Discussed in comments1 thread

    • > 1. selects a sub-collection B of A whose elements match the path pattern β, > 2. computes a new collection C as a function f of B and its neighbors, > 3. and specifies the insertion of C in place of B into A. This sounds a lot like the presentation of comonads as directed…

      whosthatguyView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.