An Investigation of the Laws of Traversals

with Ondrej Rypacek. MSFP 2012.PDFCode

Abstract

Traversals of data structures are ubiquitous in programming. Consequently, it is important to be able to characterise those structures that are traversable and understand their algebraic properties. Traversable functors have been characterised by McBride and Paterson as those equipped with a distributive law over arbitrary applicative functors; however, laws that fully capture the intuition behind traversals are missing. This article is an attempt to remedy this situation by proposing laws for characterising traversals that capture the intuition behind them. To support our claims, we prove that finitary containers are traversable in our sense and argue that elements in a traversable structure are visited exactly once.

BibTeX

@Inproceedings{EPTCS76.5,
author    = "Jaskelioff, Mauro and Rypacek, Ondrej",
year      = "2012",
title     = "An Investigation of the Laws of Traversals",
editor    = "Chapman, James and Levy, Paul Blain",
booktitle = "{\rm Proceedings Fourth Workshop on}
Mathematically Structured Functional Programming,
{\rm Tallinn, Estonia, 25 March 2012}",
series    = "Electronic Proceedings in Theoretical Computer Science",
volume    = "76",
publisher = "Open Publishing Association",
pages     = "40-49",
doi       = "10.4204/EPTCS.76.5",
}