Abstract
SML/NJ and other Standard ML variants extend the ML module system with higher-order functors, elevating the module language to a full functional language. In this paper, we describe the implementation of higher-order modules in SML/NJ, which is unique in providing “true” higher-order static behavior. This implementation is based on three key ideas: unique internal variables (entity variables) for naming static entities, factorization of the static information in both basic modules and functors into signatures and realizations, and representing the static “effects” and type-level mapping performed by a functor using a static lambda calculus (the entity calculus). This design conforms to MacQueen-Tofte’s re-elaboration semantics without having to re-elaborate functor bodies at functor applications.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Biswas, S.K.: Higher-order functors with transparent signatures. In: POPL 1995: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 154–163. ACM, New York (1995)
Crégut, P., MacQueen, D.: An implementation of higher-order functors. In: ACM SIGPLAN Workshop on Standard ML and its Applications (June 1994)
Diatchki, I.S., Jones, M.P., Hallgren, T.: A formal specification of the Haskell 98 module system. In: Haskell 2002: Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell, pp. 17–28. ACM, New York (2002)
Dreyer, D.: A type system for recursive modules. In: ICFP 2007: Proceedings of the, ACM SIGPLAN International Conference on Functional Programming, pp. 289–302. ACM, New York (2007)
Dreyer, D., Crary, K., Harper, R.: A type system for higher-order modules. In: POPL 2003: Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 236–249. ACM, New York (2003)
Dreyer, D., Rossberg, A.: Mixin’ up the ML module system. In: ICFP 2008: Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, pp. 307–320. ACM, New York (2008)
Flatt, M.: Composable and compilable macros: you want it when? In: ICFP 2002: Proceedings of the 7th ACM SIGPLAN International Conference on Functional Programming, pp. 72–83. ACM, New York (2002)
Harper, R., Lillibridge, M.: A type-theoretic approach to higher-order modules with sharing. In: POPL 1994: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 123–137. ACM, New York (1994)
Harper, R., Pierce, B.C.: Design Considerations for ML-Style Module Systems. In: Advanced Topics in Types and Programming Languages. MIT Press, Cambridge (2005)
Harper, R., Stone, C.: An interpretation of Standard ML in type theory. Technical Report CMU–CS–97–147, CMU, Pittsburgh, PA (June 1997) (Also published as Fox Memorandum CMU–CS–FOX–97–01)
Kuan, G.: True Higher-Order Module Systems, Separate Compilation, and Signature Calculi. PhD thesis, Department of Computer Science, University of Chicago, 1100 East 58th Street, Chicago, IL 60637 (June 2010)
Kuan, G., MacQueen, D.: Engineering Higher-Order Modules in SML/NJ. Technical Report TR-2010-01, Univ. of Chicago, Dept. of Computer Science, Chicago, IL (January 2010)
Leroy, X.: Manifest types, modules, and separate compilation. In: POPL 1994: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 109–122. ACM, New York (1994)
Leroy, X.: Applicative functors and fully transparent higher-order modules. In: POPL 1995: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 142–153. ACM, New York (1995)
Leroy, X.: Le système Caml Special Light: modules et compilation efficace en Caml. In: Actes des Journées Francophones des Langages Applicatifs, pp. 111–131. INRIA (January 1996)
Leroy, X.: A modular module system. J. Funct. Program. 10(3), 269–303 (2000)
MacQueen, D.B.: Using dependent types to express modular structure. In: POPL 1986: Proceedings of the 13th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp. 277–286. ACM, New York (1986)
MacQueen, D.B., Tofte, M.: A semantics for higher-order functors. In: Sannella, D. (ed.) ESOP 1994. LNCS, vol. 788, pp. 409–423. Springer, Heidelberg (1994)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML - Revised. The MIT Press, Cambridge (May 1997)
Mitchell, J.C., Plotkin, G.D.: Abstract types have existential types. In: POPL 1985: Proceedings of the 12th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp. 37–51. ACM, New York (1985)
Montagu, B., Rémy, D.: Modeling abstract types in modules with open existential types. In: Proceedings of the 36th ACM Symposium on Principles of Programming Languages (POPL 2009), Savannah, Georgia, USA, pp. 63–74 (January 2009)
Paterson, M.S., Wegman, M.N.: Linear unification. In: STOC 1976: Proceedings of the 8th annual ACM Symposium on Theory of Computing, pp. 181–186. ACM, New York (1976)
Ramsey, N.: ML module mania: A type-safe, separately compiled, extensible interpreter. Electr. Notes Theor. Comput. Sci. 148(2), 181–209 (2006)
Russo, C.V.: Types for Modules. PhD thesis, Edinburgh University (1998)
Shao, Z.: Transparent modules with fully syntactic signatures. In: ICFP 1999: Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, pp. 220–232. ACM, New York (1999)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Kuan, G., MacQueen, D. (2010). Engineering Higher-Order Modules in SML/NJ. In: Morazán, M.T., Scholz, SB. (eds) Implementation and Application of Functional Languages. IFL 2009. Lecture Notes in Computer Science, vol 6041. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-16478-1_13
Download citation
DOI: https://doi.org/10.1007/978-3-642-16478-1_13
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-16477-4
Online ISBN: 978-3-642-16478-1
eBook Packages: Computer ScienceComputer Science (R0)