skip to main content
10.1145/2535838.2535884acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Backpack: retrofitting Haskell with interfaces

Published: 08 January 2014 Publication History

Abstract

Module systems like that of Haskell permit only a weak form of modularity in which module implementations depend directly on other implementations and must be processed in dependency order. Module systems like that of ML, on the other hand, permit a stronger form of modularity in which explicit interfaces express assumptions about dependencies, and each module can be typechecked and reasoned about independently.
In this paper, we present Backpack, a new language for building separately-typecheckable *packages* on top of a weak module system like Haskell's. The design of Backpack is inspired by the MixML module calculus of Rossberg and Dreyer, but differs significantly in detail. Like MixML, Backpack supports explicit interfaces and recursive linking. Unlike MixML, Backpack supports a more flexible applicative semantics of instantiation. Moreover, its design is motivated less by foundational concerns and more by the practical concern of integration into Haskell, which has led us to advocate simplicity---in both the syntax and semantics of Backpack---over raw expressive power. The semantics of Backpack packages is defined by elaboration to sets of Haskell modules and binary interface files, thus showing how Backpack maintains interoperability with Haskell while extending it with separate typechecking. Lastly, although Backpack is geared toward integration into Haskell, its design and semantics are largely agnostic with respect to the details of the underlying core language.

Supplementary Material

MP4 File (d1_right_t2.mp4)

References

[1]
Davide Ancona, Ferruccio Damiani, Sophia Drossopoulou, and Elena Zucca. Polymorphic bytecode: compositional compilation for Javalike languages. In POPL '05.
[2]
Davide Ancona, Giovanni Lagorio, and Elena Zucca. Flexible typesafe linking of components for Java-like languages. In JMLC '06.
[3]
Davide Ancona and Elena Zucca. A calculus of module systems. JFP, 12(2), 2002.
[4]
Gilad Bracha and Gary Lindstrom. Modularity meets inheritance. In ICCL '92.
[5]
Luca Cardelli. Program fragments, linking, and modularization. In POPL '97.
[6]
Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In PLDI '99.
[7]
Iavor S. Diatchki, Mark P. Jones, and Thomas Hallgren. A formal specification of the Haskell 98 module system. In Haskell '02.
[8]
Derek Dreyer. A type system for recursive modules. In ICFP '07.
[9]
Derek Dreyer. Recursive type generativity. JFP, 17(4&5), 2007.
[10]
Dominic Duggan. Type-safe linking with recursive DLLs and shared libraries. ACM TOPLAS, 24(6):711--804, 2002.
[11]
Dominic Duggan and Constantinos Sourelis. Mixin modules. In ICFP '96.
[12]
Karl-Filip Faxen. A static semantics for Haskell. JFP, 12(5), 2002.
[13]
Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In PLDI '98.
[14]
Nadji Gauthier and François Pottier. Numbering matters: First order canonical forms for second-order recursive types. In ICFP '04.
[15]
Robert Harper and Chris Stone. A type-theoretic interpretation of Standard ML. In Proof, Language, and Interaction: Essays in Honor of Robin Milner. MIT Press, 2000.
[16]
Tom Hirschowitz and Xavier Leroy. Mixin modules in a call-by-value setting. ACM TOPLAS, 27(5):857--881, 2005.
[17]
Paul Hudak, John Hughes, Simon Peyton Jones, and PhilipWadler. A history of Haskell: Being lazy with class. In HOPL III, 2007.
[18]
Gérard Huet. Résolution d'équations dans des langages d'ordre 1, 2, ..., ω. PhD thesis, Université Paris 7, September 1976.
[19]
Hyeonseung Im, Keiko Nakata, Jacques Garrigue, and Sungwoo Park. A syntactic type system for recursive modules. In OOPSLA '11.
[20]
Xavier Leroy. Applicative functors and fully transparent higher order modules. In POPL '95.
[21]
Xavier Leroy. The Objective Caml system: Documentation and user's manual. http://caml.inria.fr/ocaml/htmlman/.
[22]
Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.
[23]
Nathaniel Nystrom, Xin Qi, and Andrew Myers. J : Nested intersection for scalable software composition. In OOPSLA '06.
[24]
Martin Odersky and Matthias Zenger. Scalable component abstractions. In OOPSLA '05.
[25]
Scott Owens and Matthew Flatt. From structures and functors to modules and units. In ICFP '06.
[26]
Andreas Rossberg. The missing link -- dynamic components for ML. In ICFP '06.
[27]
Andreas Rossberg and Derek Dreyer. Mixin' up the ML module system. ACM TOPLAS, 35(1), 2013.
[28]
Andreas Rossberg, Claudio V. Russo, and Derek Dreyer. F-ing modules. In TLDI '10. Extended version available from the author's website at: http://www.mpi-sws.org/~rossberg/f-ing.
[29]
Claudio V. Russo. Types for Modules. PhD thesis, University of Edinburgh, 1998.
[30]
Peter Sewell, James J. Leifer, Keith Wansbrough, Francesco Zappa Nardelli, Mair Allen-Williams, Pierre Habouzit, and Viktor Vafeiadis. Acute: High-level programming language design for distributed computation. JFP, 17(4--5), 2007.
[31]
David Swasey, Tom Murphy VII, Karl Crary, and Robert Harper. A separate compilation extension to Standard ML. In ML '06.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '14: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
January 2014
702 pages
ISBN:9781450325448
DOI:10.1145/2535838
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].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 08 January 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. applicative instantiation
  2. haskell modules
  3. mixin modules
  4. module systems
  5. packages
  6. recursive modules
  7. separate modular development
  8. type systems

Qualifiers

  • Research-article

Conference

POPL '14
Sponsor:

Acceptance Rates

POPL '14 Paper Acceptance Rate 51 of 220 submissions, 23%;
Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)10
  • Downloads (Last 6 weeks)2
Reflects downloads up to 25 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media