University of Oxford Logo University of OxfordDepartment of Computer Science - Home

Gradual Refinement: Blending Pattern Matching with Data Abstraction

Meng Wang‚ Jeremy Gibbons‚ Kazutaka Matsuda and Zhenjiang Hu

Abstract

Pattern matching is advantageous for understanding and reasoning about function definitions, but it tends to tightly couple the interface and implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to abstract datatypes based on a right-invertible language RINV - every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation (implemented as abstract datatypes), while maintaining simple and sound reasoning.

Details

Book Title

Mathematics of Program Construction

Editor

Jules Desharnais

Note

See revised journal version "Refactoring Pattern Matching"

Series

LNCS

Volume

6120

Year

2010

Links

BibTeX

Download  (pdf)

Link (pdf)

DOI (10.1007/978-3-642-13321-3_22)

Revised version

Related pages

People

Projects

Activities