Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1190216.1190229acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article

Modular type classes

Published: 17 January 2007 Publication History

Abstract

ML modules and Haskell type classes have proven to be highly effective tools for program structuring. Modules emphasize explicit configuration of program components and the use of data abstraction. Type classes emphasize implicit program construction and ad hoc polymorphism. In this paper, we show how the implicitly-typed style of type class programming may be supported within the framework of an explicitly-typed module language by viewing type classes as a particular mode of use of modules. This view offers a harmonious integration of modules and type classes, where type class features, such as class hierarchies and associated types, arise naturally as uses of existing module-language constructs, such as module hierarchies and type components. In addition, programmers have explicit control over which type class instances are available for use by type inference in a given scope. We formalize our approach as a Harper-Stone-style elaboration relation, and provide a sound type inference algorithm as a guide to implementation.

References

[1]
Manuel M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. Associated type synonyms. In ICFP '05.]]
[2]
Manuel M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow. Associated types with class. In POPL '05.]]
[3]
Luis Damas and Robin Milner. Principal type schemes for functional programs. In POPL '82.]]
[4]
Derek Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, May 2005.]]
[5]
Derek Dreyer and Matthias Blume. Principal type schemes for modular programs. Technical Report TR-2006-08, University of Chicago Comp. Sci. Dept., October 2006.]]
[6]
Derek Dreyer, Karl Crary, and Robert Harper. A type system for higher-order modules. In POPL '03.]]
[7]
Derek Dreyer, Robert Harper, Manuel M.T. Chakravarty, and Gabriele Keller. Modular type classes. Technical Report TR-2006-09, University of Chicago Comp. Sci. Dept., October 2006.]]
[8]
Robert Harper, John C. Mitchell, and Eugenio Moggi. Higher-order modules and the phase distinction. In POPL '90.]]
[9]
Robert Harper and Chris Stone. A type-theoretic interpretation of Standard ML. In G. Plotkin, C. Stirling, and M. Tofte, editors, Proof, Language, and Interaction: Essays in Honor of Robin Milner. MIT Press, 2000.]]
[10]
Mark P. Jones. Simplifying and improving qualified types. In FPCA '95.]]
[11]
Mark P. Jones. A theory of qualified types. In ESOP '92.]]
[12]
Mark P. Jones. Type classes with functional dependencies. In ESOP'00.]]
[13]
Mark P. Jones. Using parameterized signatures to express modular structure. In POPL '96.]]
[14]
Mark P. Jones. Qualified Types: Theory and Practice. Cambridge University Press, 1994.]]
[15]
Mark P. Jones. A system of constructor classes: Overloading and implicit higher-order polymorphism. Journal of Functional Programming, 5(1), 1995.]]
[16]
Wolfram Kahl and Jan Scheffczyk. Named instances for Haskell type classes. In Haskell Workshop, 2001.]]
[17]
David MacQueen. Modules for Standard ML. In LFP '84.]]
[18]
Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.]]
[19]
Simon Peyton Jones et al. Haskell 98 language and libraries: the revised report. Journal of Functional Programming, 13(1), 2003.]]
[20]
Gerhard Schneider. ML mit Typklassen. Master's thesis, June 2000.]]
[21]
Jeremy Siek. A Language for Generic Programming. PhD thesis, Indiana University, August 2005.]]
[22]
Jeremy Siek and Andrew Lumsdaine. Essential language support for generic programming. In PLDI'05.]]
[23]
P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad-hoc. In POPL '89.]]
[24]
Stefan Wehr. ML modules and Haskell type classes: A constructive comparison. Master's thesis, Albert-Ludwigs-Universität Freiburg, Institut für Informatik, 2005.]]

Cited By

View all
  • (2021)Logical Relations as Types: Proof-Relevant Parametricity for Program ModulesJournal of the ACM10.1145/347483468:6(1-47)Online publication date: 5-Oct-2021
  • (2019)Partial type constructors: or, making ad hoc datatypes less ad hocProceedings of the ACM on Programming Languages10.1145/33711084:POPL(1-28)Online publication date: 20-Dec-2019
  • (2019)Coherence of type class resolutionProceedings of the ACM on Programming Languages10.1145/33416953:ICFP(1-28)Online publication date: 26-Jul-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2007
400 pages
ISBN:1595935754
DOI:10.1145/1190216
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 42, Issue 1
    Proceedings of the 2007 POPL Conference
    January 2007
    379 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1190215
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 17 January 2007

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. modules
  2. type classes
  3. type inference
  4. type systems

Qualifiers

  • Article

Conference

POPL07

Acceptance Rates

Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)27
  • Downloads (Last 6 weeks)11
Reflects downloads up to 12 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2021)Logical Relations as Types: Proof-Relevant Parametricity for Program ModulesJournal of the ACM10.1145/347483468:6(1-47)Online publication date: 5-Oct-2021
  • (2019)Partial type constructors: or, making ad hoc datatypes less ad hocProceedings of the ACM on Programming Languages10.1145/33711084:POPL(1-28)Online publication date: 20-Dec-2019
  • (2019)Coherence of type class resolutionProceedings of the ACM on Programming Languages10.1145/33416953:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2019)COCHIS: Stable and coherent implicitsJournal of Functional Programming10.1017/S095679681800024229Online publication date: 8-Feb-2019
  • (2018)Static interpretation of higher-order modules in Futhark: functional GPU programming in the largeProceedings of the ACM on Programming Languages10.1145/32367922:ICFP(1-30)Online publication date: 30-Jul-2018
  • (2018)1ML – Core and modules unitedJournal of Functional Programming10.1017/S095679681800020528Online publication date: 27-Dec-2018
  • (2017)The limitations of type classes as subtyped implicits (short paper)Proceedings of the 8th ACM SIGPLAN International Symposium on Scala10.1145/3136000.3136006(8-12)Online publication date: 22-Oct-2017
  • (2017)Familia: unifying interfaces, type classes, and family polymorphismProceedings of the ACM on Programming Languages10.1145/31338941:OOPSLA(1-31)Online publication date: 12-Oct-2017
  • (2017)Constrained type familiesProceedings of the ACM on Programming Languages10.1145/31102861:ICFP(1-28)Online publication date: 29-Aug-2017
  • (2015)Modular implicitsElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.198.2198(22-63)Online publication date: 5-Dec-2015
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media