skip to main content
10.1145/2892664.2892677acmotherconferencesArticle/Chapter ViewAbstractPublication PagesmodularityConference Proceedingsconference-collections
research-article

A Lightweight Optimization Technique for Data Types a la Carte

Published: 14 March 2016 Publication History

Abstract

Data types à la carte (DTC) is a technique for adding new variants to data types modularly. A drawback of DTC compared with simple variant types, which are commonly used to define data types in functional programming languages, is runtime inefficiency caused by the destruction of these values. In this paper, we propose a lightweight optimization technique for functions that destruct the values of DTC data types. It makes their execution as efficient as their non-DTC counterparts by just (1) deriving non-extensible algebraic data types isomorphic to ex- tensible data types defined in DTC fashion and (2) using them within the type annotations that specify concrete data types using the composition operator given in DTC. The approach is based on an insight on the functions: the functions never depend on any con- crete data types but merely constrain them. We implemented functions that take an extensible data type defined in DTC fashion and derive an isomorphic non-extensible algebraic data type using Template Haskell. Our experimental re- sults show that DTC functions using our approach run as efficiently as their non-DTC counterparts and avoid performance slow down even if the data types are extended multiple times.

References

[1]
P. Bahr. Composing and decomposing data types: A closed type families implementation of data types à la carte. In Proceedings of WGP ’14, pages 71–82, 2014.
[2]
A. Gill and G. Hutton. The worker/wrapper transformation. J. Funct. Program., 19(2):227–251, Mar. 2009.
[3]
B. OSullivan. Criterion version 1.1.0. http://hackage.haskell. org/package/criterion, 2015.
[4]
T. Sheard and E. Pasalic. Two-level types and parameterized modules. Journal of Functional Programming, 14(5):547–587, 2004.
[5]
W. Swierstra. Data types à la carte. Journal of Functional Programming, 18(4):423–436, July 2008.
[6]
P. Wadler and et al. The expression problem. Discussion on the Java-Genericity mailing list, December 1998.

Cited By

View all
  • (2019)Deriving compositional random generatorsProceedings of the 31st Symposium on Implementation and Application of Functional Languages10.1145/3412932.3412943(1-12)Online publication date: 25-Sep-2019

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
MODULARITY Companion 2016: Companion Proceedings of the 15th International Conference on Modularity
March 2016
217 pages
ISBN:9781450340335
DOI:10.1145/2892664
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 14 March 2016

Permissions

Request permissions for this article.

Check for updates

Author Tag

  1. Haskell

Qualifiers

  • Research-article

Conference

Modularity '16

Acceptance Rates

Overall Acceptance Rate 41 of 139 submissions, 29%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)1
Reflects downloads up to 07 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2019)Deriving compositional random generatorsProceedings of the 31st Symposium on Implementation and Application of Functional Languages10.1145/3412932.3412943(1-12)Online publication date: 25-Sep-2019

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media