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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Kaes, S.: Parametric overloading in polymorphic programming languages. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 131–144. Springer, Heidelberg (1988)
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)
Schneider, G.: ML mit Typklassen. Master’s thesis, Universität des Saarlandes (2000), http://www.ps.uni-sb.de/Papers/abstracts/Schneider2000.html
Kahl, W., Scheffczyk, J.: Named instances for Haskell type classes. In: Hinze, R. (ed.) Proceedings of the 2001 Haskell Workshop (2001)
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)
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)
Rossberg, A.: Post to the alice-users mailing list (May 2005), http://www.ps.uni-sb.de/pipermail/alice-users/2005/000466.html
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)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)
Peyton Jones, S. (ed.): Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Cambridge (2003)
GHC: The Glasgow Haskell compiler (2008), http://www.haskell.org/ghc/
Jones, M.P., Peterson, J.: The Hugs 98 user manual (1999), http://www.haskell.org/hugs/
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
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)
Mitchell, J.C., Plotkin, G.D.: Abstract types have existential types. ACM Trans. Prog. Lang. and Systems 10(3), 470–502 (1988)
Läufer, K.: Type classes with existential types. J. Funct. Program 6(3), 485–517 (1996)
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)
Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)
Romanenko, S., Russo, C., Kokholm, N., Larsen, K.F., Sestoft, P.: Moscow ML homepage (2007), http://www.dina.dk/~sestoft/mosml.html
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)
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)
Russo, C.V.: First-class structures for Standard ML. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 336–350. Springer, Heidelberg (2000)
Jones, M.P.: Qualified Types: Theory and Practice. Cambridge University Press, Cambridge (1994)
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)
Faxén, K.F.: A static semantics for Haskell. J. Funct. Program 12(4&5), 295–357 (2002)
OCaml: Objective Caml (2007), http://caml.inria.fr/ocaml/index.en.html
Henglein, F.: Type inference with polymorphic recursion. ACM Trans. Prog. Lang. and Systems 15(2), 253–289 (1993)
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)
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)
Shan, C.: Higher-order modules in System F ω and Haskell (July 2004), http://www.eecs.harvard.edu/~ccshan/xlate/
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
Girard, J.Y.: Interpretation Fonctionnelle et Elimination des Coupures dans l’Arithmetique d’Ordre Superieur. Ph.D thesis, University of Paris VII (1972)
Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. J. Funct. Program 17(1), 1–82 (2007)
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
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)
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
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)