Journal Article10.1017/S095679680000068X
Pattern matching with abstract data types
TL;DR: This work views pattern matching as a bundling of case recognition and component selection functions instead of a method for inverting data construction, and removes the implied equivalence between data constructors and pattern constructors.
read more
Abstract: Pattern matching in modern functional programming languages is tied to the representation of data. Unfortunately, this is incompatible with the philosophy of abstract data types.Two proposals have been made to generalize pattern matching to a broader class of types. The laws mechanism of Miranda allows pattern matching with non-free algebraic data types. More recently, Wadler proposed the concept of views as a more general solution, making it possible to define arbitrary mappings between a physical implementation and a view supporting pattern matching. Originally, it was intended to include views in the new standard lazy functional programming language Haskell.Laws and views each offer important advantages, particularly with respect to data abstraction. However, if not used with great care, they also introduce serious problems in equational reasoning. As a result, laws have been removed from Miranda and views were not included in the final version of Haskell.We propose a third approach which unifies the laws and views mechanisms while avoiding their problems. Philosophically, we view pattern matching as a bundling of case recognition and component selection functions instead of a method for inverting data construction. This can be achieved by removing the implied equivalence between data constructors and pattern constructors. In practice, we allow automatic mapping into a view but not out of the view. We show that equational reasoning can still be used with the resulting system. In fact, equational reasoning is easier, since there are fewer hidden traps.
read more
Chat with Paper
AI Agents for this Paper
Find similar papers on Google Scholar, PubMed and Arxiv
Write a critical review of this paper
Analyze citations of this paper to find unaddressed research gaps
Citations
•Book
Purely functional data structures
Chris Okasaki
- 01 Jan 1998
TL;DR: This work describes several techniques for designing functional data structures, and numerous original data structures based on these techniques, including multiple variations of lists, queues, double-ended queues, and heaps, many supporting more exotic features such as random access or efficient catenation.
756
Inductive graphs and functional graph algorithms
TL;DR: A new style of writing graph algorithms in functional languages which is based on an alternative view of graphs as inductively defined data types is proposed, and it is demonstrated how graph algorithms can be succinctly given by recursive function definitions based on the inductive graph view.
103
Revealing the X/O impedance mismatch: changing lead into gold
Ralf Lämmel,Erik Meijer +1 more
- 24 Apr 2006
TL;DR: In this paper, the X/O impedance mismatch is used to describe the difficulty of the OO paradigm to accommodate XML processing by means of recasting it to typed OO programming.
49
Parse-tree annotations meet re-engineering concerns
Jan Kort,Ralf Lämmel +1 more
- 20 Oct 2003
TL;DR: In this paper, a rewriting-based approach for processing annotated parse trees is presented, which is motivated by transformations for software re-engineering where annotations can be used to implement concerns such as layout preservation and reversible preprocessing.
•Journal Article
Generic views on data types
TL;DR: In this article, the authors introduce generic views on data types and show how generic views have been added to Generic Haskell, an extension of the functional programming language Haskell that supports the construction of generic functions.
41
References
•Journal Article
Report on the Programming Language Haskell, A Non-strict, Purely Functional Language.
Paul Hudak,Simon Jones,Philip Wadler,Brian Boutel,Jon Fairbairn,Joseph Fasel,María M. Guzmán,Kevin Hammond,John Hughes,Thomas Johnsson,Richard B. Kieburtz,Rishiyur S. Nikhil,Will Partain,John Peterson +13 more
TL;DR: In this paper, a half dozen persons have written technically on combinatory logic, and most of these, including ourselves, have published something erroneous, since some of our fellow sinners are among the most careful and competent logicians on the contemporary scene.
Lawful functions and program verification in Miranda
TL;DR: This paper investigates program verification in the Miranda programming language by looking at how to deduce properties of functions over “lawful” types, and introduces sufficient model theory to explain these transfer results.
•Book
Report on the programming language Haskell : a non-strict, purely functional language
Paul Hudak,Philip Wadler +1 more
- 01 Jan 1990
TL;DR: "Some half dozen persons have written technically on combinatory logic, and most of these, including ourselves, have published something erroneous"; this is regarded as evidence that the subject is refractory.
Views: a way for pattern matching to cohabit with data abstraction
Philip Wadler
- 01 Oct 1987
TL;DR: The views mechanism is proposed, which allows any type to be viewed as a free data type, thus combining the clarity of pattern matching with the efficiency of data abstraction.
Report on the programming language Haskell: a non-strict, purely functional language version 1.2
Paul Hudak,Simon Jones,Philip Wadler,Brian Boutel,Jon Fairbairn,Joseph Fasel,María M. Guzmán,Kevin Hammond,John Hughes,Thomas Johnsson,Dick Kieburtz,Rishiyur S. Nikhil,Will Partain,John Peterson +13 more
TL;DR: In this paper, a half dozen persons have written technically on combinatory logic, and most of these, including ourselves, have published something erroneous, and since some of our fellow sinners are among the most careful and competent logicians on the contemporary scene, we regard this as evidence that the subject is refractory.
Related Papers (5)
Pedro Palao Gostanza,Ricardo Peña,Manuel Núñez +2 more
- 15 Jun 1996
Manuel Fähndrich,John Boyland +1 more
- 01 Aug 1997
[...]
Mark Tullsen
- 01 Jan 2000
Robin Milner,Mads Tofte,Robert Harper +2 more
- 01 Jan 1990