Open Access
Eta-Expansion Does The Trick
Author(s) -
Olivier Danvy,
Karoline Malmkjær,
Jens Palsberg
Publication year - 1995
Publication title -
brics report series
Language(s) - English
Resource type - Journals
eISSN - 1601-5355
pISSN - 0909-0878
DOI - 10.7146/brics.v2i41.21673
Subject(s) - disjoint sets , listing (finance) , type (biology) , correctness , sequence (biology) , computer science , function (biology) , transformation (genetics) , mathematics , continuation , arithmetic , algebra over a field , combinatorics , discrete mathematics , algorithm , pure mathematics , programming language , ecology , biochemistry , chemistry , genetics , finance , evolutionary biology , gene , economics , biology
Partial-evaluation folklore has it that massaging one's source programs can make them specialize better. In Jones, Gomard, and Sestoft's recent textbook, a whole chapter is dedicated to listing such "binding-time improvements'': non-standard use of continuation-passing style, eta-expansion, and a popular transformation called "The Trick''. We provide a unified view of these binding-time improvements, from a typing perspective. Just as a proper treatment of product values in partial evaluation requires partially static values, a proper treatment of disjoint sums requires moving static contexts across dynamic case expressions. This requirement precisely accounts for the non-standard use of continuation-passing style encountered in partial evaluation. In this setting, eta-expansion acts as a uniform binding-time coercion between values and contexts, be they of function type, product type, or disjoint-sum type. For the latter case, it achieves "The Trick''. In this paper, we extend Gomard and Jones's partial evaluator for the lambda-calculus, lambda-Mix, with products and disjoint sums; we point out how eta-expansion for disjoint sums does The Trick; we generalize our earlier work by identifying that eta-expansion can be obtained in the binding-time analysis simply by adding two coercion rules; and we specify and prove the correctness of our extension to lambda-Mix. See revised version BRICS-RS-96-17.