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.
Supplemental Material
- Davide Ancona, Ferruccio Damiani, Sophia Drossopoulou, and Elena Zucca. Polymorphic bytecode: compositional compilation for Javalike languages. In POPL '05. Google Scholar
Digital Library
- Davide Ancona, Giovanni Lagorio, and Elena Zucca. Flexible typesafe linking of components for Java-like languages. In JMLC '06. Google Scholar
Digital Library
- Davide Ancona and Elena Zucca. A calculus of module systems. JFP, 12(2), 2002. Google Scholar
Digital Library
- Gilad Bracha and Gary Lindstrom. Modularity meets inheritance. In ICCL '92.Google Scholar
- Luca Cardelli. Program fragments, linking, and modularization. In POPL '97. Google Scholar
Digital Library
- Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In PLDI '99. Google Scholar
Digital Library
- Iavor S. Diatchki, Mark P. Jones, and Thomas Hallgren. A formal specification of the Haskell 98 module system. In Haskell '02. Google Scholar
Digital Library
- Derek Dreyer. A type system for recursive modules. In ICFP '07. Google Scholar
Digital Library
- Derek Dreyer. Recursive type generativity. JFP, 17(4&5), 2007. Google Scholar
Digital Library
- Dominic Duggan. Type-safe linking with recursive DLLs and shared libraries. ACM TOPLAS, 24(6):711--804, 2002. Google Scholar
Digital Library
- Dominic Duggan and Constantinos Sourelis. Mixin modules. In ICFP '96.Google Scholar
- Karl-Filip Faxen. A static semantics for Haskell. JFP, 12(5), 2002. Google Scholar
Digital Library
- Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In PLDI '98. Google Scholar
Digital Library
- Nadji Gauthier and François Pottier. Numbering matters: First order canonical forms for second-order recursive types. In ICFP '04. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Tom Hirschowitz and Xavier Leroy. Mixin modules in a call-by-value setting. ACM TOPLAS, 27(5):857--881, 2005. Google Scholar
Digital Library
- Paul Hudak, John Hughes, Simon Peyton Jones, and PhilipWadler. A history of Haskell: Being lazy with class. In HOPL III, 2007. Google Scholar
Digital Library
- Gérard Huet. Résolution d'équations dans des langages d'ordre 1, 2, ..., ω. PhD thesis, Université Paris 7, September 1976.Google Scholar
- Hyeonseung Im, Keiko Nakata, Jacques Garrigue, and Sungwoo Park. A syntactic type system for recursive modules. In OOPSLA '11. Google Scholar
Digital Library
- Xavier Leroy. Applicative functors and fully transparent higher order modules. In POPL '95. Google Scholar
Digital Library
- Xavier Leroy. The Objective Caml system: Documentation and user's manual. http://caml.inria.fr/ocaml/htmlman/.Google Scholar
- Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997. Google Scholar
Digital Library
- Nathaniel Nystrom, Xin Qi, and Andrew Myers. J : Nested intersection for scalable software composition. In OOPSLA '06. Google Scholar
Digital Library
- Martin Odersky and Matthias Zenger. Scalable component abstractions. In OOPSLA '05. Google Scholar
Digital Library
- Scott Owens and Matthew Flatt. From structures and functors to modules and units. In ICFP '06. Google Scholar
Digital Library
- Andreas Rossberg. The missing link -- dynamic components for ML. In ICFP '06. Google Scholar
Digital Library
- Andreas Rossberg and Derek Dreyer. Mixin' up the ML module system. ACM TOPLAS, 35(1), 2013. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Claudio V. Russo. Types for Modules. PhD thesis, University of Edinburgh, 1998.Google Scholar
- 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 Scholar
Digital Library
- David Swasey, Tom Murphy VII, Karl Crary, and Robert Harper. A separate compilation extension to Standard ML. In ML '06. Google Scholar
Digital Library
Index Terms
Backpack: retrofitting Haskell with interfaces
Recommendations
Backpack: retrofitting Haskell with interfaces
POPL '14: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesModule 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 ...
Mixin’ Up the ML Module System
ML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules ...
Mixin' up the ML module system
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programmingML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules ...







Comments