skip to main content
10.1145/1411318.1411324acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

A comparison of c++ concepts and haskell type classes

Published: 20 September 2008 Publication History
  • Get Citation Alerts
  • Abstract

    Earlier studies have introduced a list of high-level evaluation criteria to assess how well a language supports generic programming. Since each language that meets all criteria is considered generic, those criteria are not fine-grained enough to differentiate between languages for generic programming. We refine these criteria into a taxonomy that captures differences between type classes in Haskell and concepts in C++, and discuss which differences are incidental and which ones are due to other language features. The taxonomy allows for an improved understanding of language support for generic programming, and the comparison is useful for the ongoing discussions among language designers and users of both languages.

    References

    [1]
    M. H. Austern. Generic programming and the STL: using and extending the C++ Standard Template Library. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1998.
    [2]
    W. Brown, C. Jefferson, A. Meredith, and J. Widman. Named requirements for C++ concepts. Technical Report N2581=08-0091, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, Mar. 2008.
    [3]
    L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv., 17 (4): 471--523, Dec. 1985.
    [4]
    M. M. T. Chakravarty, G. Keller, and S. Peyton Jones. Associated type synonyms. SIGPLAN Not., 40 (9): 241--253, Sept. 2005.
    [5]
    M. M. T. Chakravarty, G. Keller, S. Peyton Jones, and S. Marlow. Associated types with class. In Proc. 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 1--13. ACM, 2005.
    [6]
    G. Dos Reis and B. Stroustrup. Specifying C++ concepts. In Proc. 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 295--308, New York, NY, USA, 2006. ACM.
    [7]
    R. Garcia, J. Jarvi, A. Lumsdaine, J. Siek, and J. Willcock. An extended comparative study of language support for generic programming. J. Funct. Program., 17 (2): 145--205, Mar. 2007.
    [8]
    J. Gibbons. Datatype-generic programming. In Spring School on Datatype-Generic Programming, volume 4719 of LNCS, pages 1--71. Springer, 2007.
    [9]
    P. Gottschling. Fundamental algebraic concepts in concept-enabled C++. Technical Report 638, Indiana University, 2006.
    [10]
    P. Gottschling. Concept implication and requirement propagation. Technical Report N2646=08-0156, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, May 2008.
    [11]
    D. Gregor. ConceptGCC - a prototype compiler for C++ concepts. http://www.generic-programming.org/software/ConceptGCC/, Jan. 2008.
    [12]
    D. Gregor. Type-soundness and optimization in the concepts proposal. Technical Report N2576=08-0086, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, Mar. 2008.
    [13]
    D. Gregor and J. Siek. Implementing concepts. Technical Report N1848=05-0108, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, Aug. 2005.
    [14]
    D. Gregor, J. Järvi, J. Siek, B. Stroustrup, G. Dos Reis, and A. Lumsdaine. Concepts: Linguistic support for generic programming in C++. In Proc. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 291--310, Oct. 2006.
    [15]
    D. Gregor, B. Stroustrup, J. Widman, and J. Siek. Proposed wording for concepts (revision 5). Technical Report N2617=08-0127, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, Programming Language C++, May 2008.
    [16]
    R. Hinze and S. Peyton Jones. Derivable type classes. In G. Hutton, editor, Proc. 2000 ACM SIGPLAN Haskell Workshop, volume 41.1 of Electronic Notes in Theoretical Computer Science. Elsevier Science, 2001.
    [17]
    P. Jansson and J. Jeuring. PolyP - a polytypic programming language extension. In Proc. POPL'97: Principles of Programming Languages, pages 470--482. ACM, 1997.
    [18]
    M. Jazayeri, R. Loos, and D. Musser, editors. Generic Programming: International Seminar, Dagstuhl Castle, Germany, 1998, Selected Papers, volume 1766 of LNCS, 2000. Springer.
    [19]
    M. P. Jones. A system of constructor classes: overloading and implicit higher-order polymorphism. In Proc. Conference on Functional Programming Languages and Computer Architecture (FPCA), pages 52--61, New York, NY, USA, 1993. ACM.
    [20]
    M. P. Jones. Type classes with functional dependencies. In Programming Languages and Systems, volume 1782 of LNCS, pages 230--244. Springer, 2000.
    [21]
    M. P. Jones. Dictionary-free overloading by partial evaluation. LISP and Symbolic Computation, 8 (3): 229--248, 1994.
    [22]
    W. Kahl and J. Scheffczyk. Named instances for Haskell type classes. In R. Hinze, editor, Proc. 2001 ACM SIGPLAN Haskell Workshop, pages 77--99. Elsevier Science, 2001.
    [23]
    O. Kiselyov and S. Peyton Jones. Choosing a type-class instance based on the context, Apr. 2008. URL http://haskell.org/haskellwiki/GHC/AdvancedOverlap.
    [24]
    O. Kiselyov and C.-C. Shan. Lightweight static resources, for safe embedded and systems programming. In Draft Proceedings of Trends in Functional Programming. Seton Hall University, 2007.
    [25]
    J. Meacham. Class alias proposal for Haskell, 2006. URL http://repetae.net/recent/out/classalias.html.
    [26]
    N. Mitchell. Deriving generic functions by example. Technical report, Dept. of Computer Science, University of York, UK, 2007. Tech. Report YCS-2007-421.
    [27]
    G. Munkby, A. P. Priesnitz, S. Schupp, and M. Zalewski. Scrap++: Scrap your boilerplate in C++. In WGP'06: Proc. of the 2006 ACM SIGPLAN Workshop on Generic Programming, pages 66--75. ACM, 2006.
    [28]
    S. Peyton Jones. Haskell 98 Language and Libraries: the Revised Report. Cambridge University Press, 2003.
    [29]
    S. Peyton Jones, M. Jones, and E. Meijer. Type classes: an exploration of the design space. In Haskell Workshop, 1997.
    [30]
    R. Rivera, B. Dawes, and D. Abrahams. The boost C++ libraries. http://www.boost.org/, 2008.
    [31]
    A. Rodriguez, J. Jeuring, P. Jansson, A. Gerdes, O. Kiselyov, and B. C. d. S. Oliveira. Comparing libraries for generic programming in Haskell. Technical report, Utrecht University, 2008. Short version is in Proc. 2008 ACM SIGPLAN Haskell Symposium.
    [32]
    T. Schrijvers, S. Peyton Jones, M. Chakravarty, and M. Sulzmann. Type checking with open type functions. In ICFP'08: The 13th ACM SIGPLAN International Conference on Functional Programming. ACM, 2008.
    [33]
    T. Sheard. Generic programming in Ωmega. In Datatype-Generic Programming, volume 4719 of LNCS, pages 258--284. Springer, 2007.
    [34]
    T. Sheard and S. Peyton Jones. Template meta-programming for Haskell. SIGPLAN Not., 37 (12): 60--75, Dec. 2002.
    [35]
    J. G. Siek and A. Lumsdaine. Essential language support for generic programming. In PLDI '05: Proc. ACM SIGPLAN 2005 conference on Programming language design and implementation, pages 73--84, New York, NY, USA, June 2005. ACM.
    [36]
    A. A. Stepanov and M. Lee. The standard template library. Technical Report HPL-95-11(R.1), Hewlett Packard Laboratories, Palo Alto, CA, USA, Nov. 1995.
    [37]
    M. Sulzmann and M. Wang. Modular generic programming with extensible superclasses. In WGP '06: Proc. 2006 ACM SIGPLAN workshop on Generic programming, pages 55--65, New York, NY, USA, 2006. ACM.
    [38]
    M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In TLDI '07: proc. 2007 ACM SIGPLAN international workshop on Types in languages design and implementation, pages 53--66, New York, NY, USA, 2007. ACM.
    [39]
    M. Sulzmann, G. J. Duck, S. Peyton-Jones, and P. J. Stuckey. Understanding functional dependencies via constraint handling rules. J. Funct. Program., 17 (1): 83--129, Jan. 2007.
    [40]
    D. Vandevoorde and N. M. Josuttis. C++ Templates: The Complete Guide. Addison-Wesley Professional, Nov. 2002.
    [41]
    P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In POPL '89: Proc. 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 60--76. ACM, 1989.
    [42]
    J. Willcock, J. Järvi, A. Lumsdaine, and D. Musser. A formalization of concepts for generic programming. In Concepts: a Linguistic Foundation of Generic Programming at Adobe Tech Summit. Adobe Systems, Apr. 2004.
    [43]
    M. Zalewski, A. P. Priesnitz, C. Ionescu, N. Botta, and S. Schupp. Multi-language library development: From Haskell type classes to C++ concepts. In MPOOL 2007, 2007.

    Cited By

    View all
    • (2017)Systems level liveness with extemporeProceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3133850.3133858(214-228)Online publication date: 25-Oct-2017
    • (2016)Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of ImprovementProgramming Languages10.1007/978-3-319-45279-1_1(1-15)Online publication date: 17-Sep-2016
    • (2012)Using functional languages to facilitate C++ metaprogrammingProceedings of the 8th ACM SIGPLAN workshop on Generic programming10.1145/2364394.2364400(33-44)Online publication date: 12-Sep-2012
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    WGP '08: Proceedings of the ACM SIGPLAN workshop on Generic programming
    September 2008
    80 pages
    ISBN:9781605580609
    DOI:10.1145/1411318
    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: 20 September 2008

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. c++
    2. concepts
    3. generic programming
    4. haskell
    5. specification-driven development
    6. type classes

    Qualifiers

    • Research-article

    Conference

    ICFP08
    Sponsor:

    Acceptance Rates

    WGP '08 Paper Acceptance Rate 6 of 10 submissions, 60%;
    Overall Acceptance Rate 30 of 43 submissions, 70%

    Upcoming Conference

    ICFP '24

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)22
    • Downloads (Last 6 weeks)6
    Reflects downloads up to 06 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2017)Systems level liveness with extemporeProceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3133850.3133858(214-228)Online publication date: 25-Oct-2017
    • (2016)Language Support for Generic Programming in Object-Oriented Languages: Peculiarities, Drawbacks, Ways of ImprovementProgramming Languages10.1007/978-3-319-45279-1_1(1-15)Online publication date: 17-Sep-2016
    • (2012)Using functional languages to facilitate C++ metaprogrammingProceedings of the 8th ACM SIGPLAN workshop on Generic programming10.1145/2364394.2364400(33-44)Online publication date: 12-Sep-2012
    • (2011)JavaGIACM Transactions on Programming Languages and Systems10.1145/1985342.198534333:4(1-83)Online publication date: 1-Jul-2011
    • (2011)Design of concept libraries for c++Proceedings of the 4th international conference on Software Language Engineering10.1007/978-3-642-28830-2_6(97-118)Online publication date: 3-Jul-2011
    • (2010)Type classes as objects and implicitsACM SIGPLAN Notices10.1145/1932682.186948945:10(341-360)Online publication date: 17-Oct-2010
    • (2010)Type classes as objects and implicitsProceedings of the ACM international conference on Object oriented programming systems languages and applications10.1145/1869459.1869489(341-360)Online publication date: 17-Oct-2010
    • (2010)Generic programming with c++ concepts and haskell type classesJournal of Functional Programming10.1017/S095679681000016X20:3-4(271-302)Online publication date: 1-Jul-2010
    • (2009)The function concept in C++Proceedings of the 2009 ACM SIGPLAN workshop on Generic programming10.1145/1596614.1596619(25-36)Online publication date: 30-Aug-2009
    • (2009)Generic Libraries in C++ with Concepts from High-Level Domain Descriptions in HaskellProceedings of the IFIP TC 2 Working Conference on Domain-Specific Languages10.1007/978-3-642-03034-5_12(236-261)Online publication date: 2-Jul-2009
    • 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