Skip to main content

Engineering Higher-Order Modules in SML/NJ

  • Conference paper
Implementation and Application of Functional Languages (IFL 2009)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 6041))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Crégut, P., MacQueen, D.: An implementation of higher-order functors. In: ACM SIGPLAN Workshop on Standard ML and its Applications (June 1994)

    Google Scholar 

  3. 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)

    Google Scholar 

  4. 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)

    Chapter  Google Scholar 

  5. 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)

    Google Scholar 

  6. 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)

    Google Scholar 

  7. 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)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Harper, R., Pierce, B.C.: Design Considerations for ML-Style Module Systems. In: Advanced Topics in Types and Programming Languages. MIT Press, Cambridge (2005)

    Google Scholar 

  10. 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)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Google Scholar 

  13. 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)

    Google Scholar 

  14. 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)

    Google Scholar 

  15. 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)

    Google Scholar 

  16. Leroy, X.: A modular module system. J. Funct. Program. 10(3), 269–303 (2000)

    Article  MATH  Google Scholar 

  17. 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)

    Google Scholar 

  18. 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)

    Chapter  Google Scholar 

  19. Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML - Revised. The MIT Press, Cambridge (May 1997)

    Google Scholar 

  20. 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)

    Google Scholar 

  21. 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)

    Google Scholar 

  22. 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)

    Google Scholar 

  23. Ramsey, N.: ML module mania: A type-safe, separately compiled, extensible interpreter. Electr. Notes Theor. Comput. Sci. 148(2), 181–209 (2006)

    Article  Google Scholar 

  24. Russo, C.V.: Types for Modules. PhD thesis, Edinburgh University (1998)

    Google Scholar 

  25. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics