skip to main content
research-article

Backpack: retrofitting Haskell with interfaces

Published:08 January 2014Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Davide Ancona, Giovanni Lagorio, and Elena Zucca. Flexible typesafe linking of components for Java-like languages. In JMLC '06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Davide Ancona and Elena Zucca. A calculus of module systems. JFP, 12(2), 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Gilad Bracha and Gary Lindstrom. Modularity meets inheritance. In ICCL '92.Google ScholarGoogle Scholar
  5. Luca Cardelli. Program fragments, linking, and modularization. In POPL '97. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In PLDI '99. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Iavor S. Diatchki, Mark P. Jones, and Thomas Hallgren. A formal specification of the Haskell 98 module system. In Haskell '02. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Derek Dreyer. A type system for recursive modules. In ICFP '07. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Derek Dreyer. Recursive type generativity. JFP, 17(4&5), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Dominic Duggan. Type-safe linking with recursive DLLs and shared libraries. ACM TOPLAS, 24(6):711--804, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Dominic Duggan and Constantinos Sourelis. Mixin modules. In ICFP '96.Google ScholarGoogle Scholar
  12. Karl-Filip Faxen. A static semantics for Haskell. JFP, 12(5), 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In PLDI '98. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Nadji Gauthier and François Pottier. Numbering matters: First order canonical forms for second-order recursive types. In ICFP '04. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Tom Hirschowitz and Xavier Leroy. Mixin modules in a call-by-value setting. ACM TOPLAS, 27(5):857--881, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Paul Hudak, John Hughes, Simon Peyton Jones, and PhilipWadler. A history of Haskell: Being lazy with class. In HOPL III, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gérard Huet. Résolution d'équations dans des langages d'ordre 1, 2, ..., ω. PhD thesis, Université Paris 7, September 1976.Google ScholarGoogle Scholar
  19. Hyeonseung Im, Keiko Nakata, Jacques Garrigue, and Sungwoo Park. A syntactic type system for recursive modules. In OOPSLA '11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Xavier Leroy. Applicative functors and fully transparent higher order modules. In POPL '95. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Xavier Leroy. The Objective Caml system: Documentation and user's manual. http://caml.inria.fr/ocaml/htmlman/.Google ScholarGoogle Scholar
  22. Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Nathaniel Nystrom, Xin Qi, and Andrew Myers. J : Nested intersection for scalable software composition. In OOPSLA '06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Martin Odersky and Matthias Zenger. Scalable component abstractions. In OOPSLA '05. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Scott Owens and Matthew Flatt. From structures and functors to modules and units. In ICFP '06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Andreas Rossberg. The missing link -- dynamic components for ML. In ICFP '06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Andreas Rossberg and Derek Dreyer. Mixin' up the ML module system. ACM TOPLAS, 35(1), 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Claudio V. Russo. Types for Modules. PhD thesis, University of Edinburgh, 1998.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. David Swasey, Tom Murphy VII, Karl Crary, and Robert Harper. A separate compilation extension to Standard ML. In ML '06. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Backpack: retrofitting Haskell with interfaces

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!