Skip to main content

ML Modules and Haskell Type Classes: A Constructive Comparison

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5356))

Abstract

Researchers repeatedly observed that the module system of ML and the type class mechanism of Haskell are related. So far, this relationship has received little formal investigation. The work at hand fills this gap: It introduces type-preserving translations from modules to type classes and vice versa, which enable a thorough comparison of the two concepts.

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

Buying options

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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Kaes, S.: Parametric overloading in polymorphic programming languages. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 131–144. Springer, Heidelberg (1988)

    Google Scholar 

  2. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: Proc. 16th ACM Symp. POPL, Austin, Texas, pp. 60–76. ACM Press, New York (1989)

    Google Scholar 

  3. Schneider, G.: ML mit Typklassen. Master’s thesis, Universität des Saarlandes (2000), http://www.ps.uni-sb.de/Papers/abstracts/Schneider2000.html

  4. Kahl, W., Scheffczyk, J.: Named instances for Haskell type classes. In: Hinze, R. (ed.) Proceedings of the 2001 Haskell Workshop (2001)

    Google Scholar 

  5. Chakravarty, M., Keller, G., Peyton Jones, S., Marlow, S.: Associated types with class. In: Abadi, M. (ed.) Proc. 32nd ACM Symp. POPL, Long Beach, CA, USA, pp. 1–13. ACM Press, New York (2005)

    Google Scholar 

  6. Chakravarty, M., Keller, G., Peyton Jones, S.: Associated type synonyms. In: Pierce, B.C. (ed.) Proc. ICFP 2005, Tallinn, Estonia, pp. 241–253. ACM Press, New York (2005)

    Google Scholar 

  7. Rossberg, A.: Post to the alice-users mailing list (May 2005), http://www.ps.uni-sb.de/pipermail/alice-users/2005/000466.html

  8. Dreyer, D., Harper, R., Chakravarty, M.: Modular type classes. In: Felleisen, M. (ed.) Proc. 34th ACM Symp. POPL, Nice, France, pp. 63–70. ACM Press, New York (2007)

    Google Scholar 

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

    Google Scholar 

  10. Peyton Jones, S. (ed.): Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Cambridge (2003)

    MATH  Google Scholar 

  11. GHC: The Glasgow Haskell compiler (2008), http://www.haskell.org/ghc/

  12. Jones, M.P., Peterson, J.: The Hugs 98 user manual (1999), http://www.haskell.org/hugs/

  13. Wehr, S.: ML modules and Haskell type classes: A constructive comparison. Master’s thesis, Albert-Ludwigs-Universität Freiburg (November 2005), http://www.informatik.uni-freiburg.de/~wehr/publications/Wehr2005.html

  14. Peyton Jones, S., Jones, M., Meijer, E.: Type classes: An exploration of the design space. In: Launchbury, J. (ed.) Proc. of the Haskell Workshop, Amsterdam, The Netherlands (June 1997)

    Google Scholar 

  15. Mitchell, J.C., Plotkin, G.D.: Abstract types have existential types. ACM Trans. Prog. Lang. and Systems 10(3), 470–502 (1988)

    Article  Google Scholar 

  16. Läufer, K.: Type classes with existential types. J. Funct. Program 6(3), 485–517 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  17. Chakravarty, M.M.T., Keller, G., Peyton Jones, S.: Associated type synonyms. In: Pierce, B.C. (ed.) Proc. ICFP 2005, Tallinn, Estonia, pp. 241–253. ACM Press, New York (2005)

    Google Scholar 

  18. Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  19. Romanenko, S., Russo, C., Kokholm, N., Larsen, K.F., Sestoft, P.: Moscow ML homepage (2007), http://www.dina.dk/~sestoft/mosml.html

  20. Crary, K., Harper, R., Puri, S.: What is a recursive module? In: Proc. 1999 PLDI, Atlanta, Georgia, USA, May 1999. SIGPLAN Notices, vol. 34(5), pp. 50–63 (1999)

    Google Scholar 

  21. Russo, C.V.: Recursive structures for Standard ML. In: Leroy, X. (ed.) Proc. 2001 ICFP, Florence, Italy, September 2001, pp. 50–61. ACM Press, New York (2001)

    Google Scholar 

  22. Russo, C.V.: First-class structures for Standard ML. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 336–350. Springer, Heidelberg (2000)

    Google Scholar 

  23. Jones, M.P.: Qualified Types: Theory and Practice. Cambridge University Press, Cambridge (1994)

    Book  MATH  Google Scholar 

  24. Hall, C.V., Hammond, K., Peyton Jones, S.L., Wadler, P.L.: Type classes in Haskell. ACM Trans. Prog. Lang. and Systems 18(2), 109–138 (1996)

    Article  Google Scholar 

  25. Faxén, K.F.: A static semantics for Haskell. J. Funct. Program 12(4&5), 295–357 (2002)

    MathSciNet  MATH  Google Scholar 

  26. OCaml: Objective Caml (2007), http://caml.inria.fr/ocaml/index.en.html

  27. Henglein, F.: Type inference with polymorphic recursion. ACM Trans. Prog. Lang. and Systems 15(2), 253–289 (1993)

    Article  Google Scholar 

  28. Harper, R., Stone, C.: A type-theoretic interpretation of Standard ML. In: Plotkin, G., Stirling, C., Tofte, M. (eds.) Proof, Language, and Interaction: Essays in Honor of Robin Milner. MIT Press, Cambridge (2000)

    Google Scholar 

  29. Leroy, X.: Applicative functors and fully transparent higher-order modules. In: Proc. 1995 ACM Symp. POPL, San Francisco, CA, USA, pp. 142–153. ACM Press, New York (1995)

    Google Scholar 

  30. Shan, C.: Higher-order modules in System F ω and Haskell (July 2004), http://www.eecs.harvard.edu/~ccshan/xlate/

  31. Dreyer, D., Crary, K., Harper, R.: A type system for higher-order modules. In: Morrisett, G. (ed.) Proc. 30th ACM Symp. POPL, New Orleans, LA, USA, January 2003, pp. 236–249. ACM Press, New York (2003); ACM SIGPLAN Notices (38)1

    Google Scholar 

  32. Girard, J.Y.: Interpretation Fonctionnelle et Elimination des Coupures dans l’Arithmetique d’Ordre Superieur. Ph.D thesis, University of Paris VII (1972)

    Google Scholar 

  33. Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. J. Funct. Program 17(1), 1–82 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  34. Kiselyov, O.: Applicative translucent functors in Haskell. Post to the Haskell mailing list (August 2004), http://www.haskell.org/pipermail/haskell/2004-August/014463.html

  35. Jones, M.P.: Using parameterized signatures to express modular structure. In: Proc. 1996 ACM Symp. POPL, St. Petersburg, FL, USA. ACM Press, New York (1996)

    Google Scholar 

  36. Nicklisch, J., Peyton Jones, S.: An exploration of modular programs. In: Proc. 1996 Glasgow Workshop on Functional Programming (July 1996), http://www.dcs.gla.ac.uk/fp/workshops/fpw96/Nicklisch.pdf

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Wehr, S., Chakravarty, M.M.T. (2008). ML Modules and Haskell Type Classes: A Constructive Comparison. In: Ramalingam, G. (eds) Programming Languages and Systems. APLAS 2008. Lecture Notes in Computer Science, vol 5356. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-89330-1_14

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-89330-1_14

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-89329-5

  • Online ISBN: 978-3-540-89330-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics