Advertisement

ML Modules and Haskell Type Classes: A Constructive Comparison

  • Stefan Wehr
  • Manuel M. T. Chakravarty
Part of the Lecture Notes in Computer Science book series (LNCS, 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.

Keywords

Module System Type Class Type Component Abstract Type Formal Translation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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. 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. 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. 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. 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. 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. 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. 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. 9.
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)Google Scholar
  10. 10.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Cambridge (2003)zbMATHGoogle Scholar
  11. 11.
    GHC: The Glasgow Haskell compiler (2008), http://www.haskell.org/ghc/
  12. 12.
    Jones, M.P., Peterson, J.: The Hugs 98 user manual (1999), http://www.haskell.org/hugs/
  13. 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. 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. 15.
    Mitchell, J.C., Plotkin, G.D.: Abstract types have existential types. ACM Trans. Prog. Lang. and Systems 10(3), 470–502 (1988)CrossRefGoogle Scholar
  16. 16.
    Läufer, K.: Type classes with existential types. J. Funct. Program 6(3), 485–517 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 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. 18.
    Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  19. 19.
    Romanenko, S., Russo, C., Kokholm, N., Larsen, K.F., Sestoft, P.: Moscow ML homepage (2007), http://www.dina.dk/~sestoft/mosml.html
  20. 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. 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. 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. 23.
    Jones, M.P.: Qualified Types: Theory and Practice. Cambridge University Press, Cambridge (1994)CrossRefzbMATHGoogle Scholar
  24. 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)CrossRefGoogle Scholar
  25. 25.
    Faxén, K.F.: A static semantics for Haskell. J. Funct. Program 12(4&5), 295–357 (2002)MathSciNetzbMATHGoogle Scholar
  26. 26.
    OCaml: Objective Caml (2007), http://caml.inria.fr/ocaml/index.en.html
  27. 27.
    Henglein, F.: Type inference with polymorphic recursion. ACM Trans. Prog. Lang. and Systems 15(2), 253–289 (1993)CrossRefGoogle Scholar
  28. 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. 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. 30.
    Shan, C.: Higher-order modules in System Fω and Haskell (July 2004), http://www.eecs.harvard.edu/~ccshan/xlate/
  31. 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. 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. 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)MathSciNetCrossRefzbMATHGoogle Scholar
  34. 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. 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. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Stefan Wehr
    • 1
  • Manuel M. T. Chakravarty
    • 2
  1. 1.Institut für InformatikUniversität FreiburgFreiburg i. Br.Germany
  2. 2.School of Computer Science and EngineeringThe University of New South Wales, UNSW SYDNEY NSWAustralia

Personalised recommendations