Nothing Special   »   [go: up one dir, main page]

skip to main content
article

Generic programming with c++ concepts and haskell type classes: A comparison

Published: 01 July 2010 Publication History

Abstract

Earlier studies have introduced a list of high-level evaluation criteria to assess how well a language supports generic programming. Languages that meet all criteria include Haskell because of its type classes and C++ with the concept feature. We refine these criteria into a taxonomy that captures commonalities and 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]
Austern, M. H. (1998) Generic Programming and the STL: Using and Extending the C++ Standard Template Library. Addison-Wesley Longman Publishing Co., Inc.
[2]
Becker, P. (ed) (June 2009) Working Draft, Standard for Programming Language C++. Number N2914=09-0104 in JTC1/SC22/WG21 - C++. ISO/IEC.
[3]
Bernardy, J., Jansson, P., Zalewski, M., Schupp, S. & Priesnitz, A. (2008) A comparison of C++ concepts and Haskell type classes. In Proceeding of the ACM SIGPLAN Workshop on Generic Programming (WGP 2008). ACM, pp. 37-48.
[4]
Boost. (2009). The Boost initiative for free peer-reviewed portable C++ source libraries. Available at: http://www.boost.org.
[5]
Brown, W., Jefferson, C., Meredith, A. & Widman, J. (2008) Named Requirements for C++ Concepts. Technical Report N2581=08-0091, ISO/IEC JTC1/SC22/WG21 - C++.
[6]
Cardelli, L. & Wegner, P. (1985) On understanding types, data abstraction, and polymorphism, ACM Comput. Surv., 17 (4): 471-523. ISSN 0360-0300.
[7]
Chakravarty, M. M. T., Keller, G. & Peyton Jones, S. (September 2005a) Associated type synonyms, SIGPLAN Not., 40 (9): 241-253.
[8]
Chakravarty, M. M. T., Keller, G., Peyton Jones, S. & Marlow, S. (2005b) Associated types with class. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, pp. 1-13.
[9]
Dos Reis, G. & Stroustrup, B. (2006) Specifying C++ concepts. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). ACM, pp. 295-308.
[10]
Garcia, R., Jarvi, J., Lumsdaine, A., Siek, J. & Willcock, J. (2007) An extended comparative study of language support for generic programming. J. Funct. Program., 17(2):145-205.
[11]
Gibbons, J. (2007) Datatype-generic programming. In Spring School on Datatype-Generic Programming, volume 4719 of LNCS. Springer, pp. 1-71.
[12]
Gottschling, P. (2008) Concept Implication and Requirement Propagation. Technical Report N2646=08-0156, ISO/IEC JTC1/SC22/WG21 - C++.
[13]
Gregor, D. (January 2008a) ConceptGCC -- a prototype compiler for C++ concepts {online} Available at: http://www.generic-programming.org/software/ConceptGCC/.
[14]
Gregor, D. (2008b) Type-Soundness and Optimization in the Concepts Proposal. Technical Report N2576=08-0086, ISO/IEC JTC1/SC22/WG21 - C++.
[15]
Gregor, D. (August 2009) What happened in Frankfurt? C++-Next, The next generation of C++ {online}. Available at: http://cpp-next.com/archive/2009/08/ what-happened-in-frankfurt/.
[16]
Gregor, D., Järvi, J., Siek, J., Stroustrup, B., Dos Reis, G. & Lumsdaine, A. (2006) Concepts: Linguistic support for generic programming in C++. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages & Applications (OOPSLA), pp. 291-310.
[17]
Gregor, D. & Siek, J. (August 2005) Implementing Concepts. Technical Report N1848=05-0108, ISO/IEC JTC1/SC22/WG21 - C++.
[18]
Hinze, R. & Peyton Jones, S. (2001) Derivable type classes. In Proceedings of the 2000 ACM SIGPLAN Haskell Workshop, Hutton, G. (ed), vol. 41.1 of Electronic Notes in Theoretical Computer Science. Elsevier Science.
[19]
Jansson, P. & Jeuring, J. (1997) PolyP -- a polytypic programming language extension. In Proceedings of the Principles of Programming Languages (POPL 1997:). ACM Press, pp. 470-482.
[20]
Jazayeri, M., Loos, R. & Musser, D., (eds) (2000) In Generic Programming: International Seminar, Dagstuhl Castle, Germany, 1998, Selected Papers, vol. 1766 of Springer.
[21]
Jones, M. P. (1993) A system of constructor classes: overloading and implicit higher-order polymorphism. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA). ACM, pp. 52-61.
[22]
Jones, M. P. (1995) Dictionary-free overloading by partial evaluation. LISP Symb. Comput., 8 (3):229-248.
[23]
Jones, M. P. (2000) Type classes with functional dependencies. In Programming Languages and Systems, vol. 1782 of LNCS. Springer, pp. 230-244.
[24]
Kahl, W. & Scheffczyk, J. (2001) Named instances for Haskell type classes. In Proceedings of the 2001 ACM SIGPLAN Haskell Workshop, Hinze, R. (ed), Elsevier Science, pp. 77-99.
[25]
Kapur, D. & Musser, D. (1992) Tecton: A Framework for Specifying and Verifying Generic System Components. Technical Report, Rensselaer Polytechnic Institute {online}. Available at: URL http://www.cs.rpi.edu/ musser/gp/tecton/tpcd-tecton.ps.
[26]
Kiselyov, O. & Peyton Jones, S. (April 2008) Choosing a type-class instance based on the context {online}. Available at: http://haskell.org/haskellwiki/GHC/AdvancedOverlap.
[27]
Kiselyov, O. & Shan, C.-C. (2007) Lightweight static resources, for safe embedded and systems programming. In Draft Proceedings of Trends in Functional Programming. Seton Hall University.
[28]
Lincke, D., Jansson, P., Zalewski, M. & Ionescu, C. (July 2009) Generic libraries in C++ with concepts from High-Level domain descriptions in Haskell. In IFIP TC 2 Working Conference on Domain-Specific Languages, pp. 236-261.
[29]
McBride, C. (2010) She's faking it {online}. Available at: http://personal.cis. strath.ac.uk/ conor/pub/she/faking.html.
[30]
Meacham, J. (2006) Class alias proposal for Haskell {online}. Available at: http://repetae. net/recent/out/classalias.html.
[31]
Mitchell, N. (2007) Deriving Generic Functions by Example. Technical Report, Dept. of Computer Science, University of York, UK. Tech. Report YCS-2007-421.
[32]
Munkby, G., Priesnitz, A., Schupp, S. & Zalewski, M. Scrap++: Scrap your boilerplate in C++. (2010) In Proceedings of the 2006 ACM SIGPLAN Workshop on Generic Programming (WGP 2006). ACM Press, pp. 66-75.
[33]
Orchard, D. & Schrijvers, T. (2010) Haskell type constraints unleashed. In Proceedings of the 2010 International Symposium on Functional and Logic Programming (FLOPS 2010:). Springer.
[34]
Peyton Jones, S. (2003) Haskell 98 Language and Libraries: the Revised Report. Cambridge University Press.
[35]
Peyton Jones, S., Jones, M. & Meijer, E. (1997) Type classes: an exploration of the design space. In Haskell Workshop {online}. Available at: http://research.microsoft. com/en-us/um/people/simonpj/papers/type-class-design-space/.
[36]
Rodriguez, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O. & Oliveira, B. C. d. S. (2008) Comparing libraries for generic programming in Haskell. In Haskell 2008. ACM, pp. 111-122.
[37]
Schrijvers, T., Peyton Jones, S., Chakravarty, M. & Sulzmann, M. (2008) Type checking with open type functions. In Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP 2008). ACM Press.
[38]
Schrijvers, T., Stuckey, P. & Wadler, P. (2009) Monadic constraint programming, J. Funct. Program., 19 (6): 1-35.
[39]
Sheard, T. Generic Programming in Omega. (2007) In Datatype-Generic Programming, vol. 4719 of LNCS. Springer, pp. 258-284.
[40]
Sheard, T. & Peyton Jones, S. (December 2002) Template meta-programming for Haskell. SIGPLAN Not., 37 (12): 60-75.
[41]
Siek, J. G. & Lumsdaine, A. (June 2005) Essential language support for generic programming. In Proceedings of the ACM SIGPLAN 2005 Conference on Programming Language Design and Implementation (PLDI 2005). ACM Press.
[42]
Stepanov, A. A. & Lee, M. (November 1995) The Standard Template Library. Technical Report HPL-95-11(R.1), Hewlett Packard Laboratories, Palo Alto, CA, USA.
[43]
Stroustrup, B. (June 2009a) Simplifying the Use of Concepts. Technical Report N2906=09- 0096, ISO/IEC JTC1/SC22/WG21 - C++.
[44]
Stroustrup, B. (July 2009b) The C++0x "Remove Concepts" Decision. Dr. Dobb's.
[45]
Sulzmann, M., Chakravarty, M. M. T., Peyton Jones, S. & Donnelly, K. (2007a) System F with type equality coercions. In Proceedings of the 2007 ACM SIGPLAN international Workshop on Types in Languages Design and Implementation (TLDI 2007). ACM Press, pages 53-66.
[46]
Sulzmann, M., Duck, G. J., Peyton-Jones, S. & Stuckey, P. J. (2007b) Understanding functional dependencies via constraint handling rules, J. Funct. Program., 17 (1): 83-129.
[47]
Vandevoorde, D. & Josuttis, N. M. (November 2002) C++ Templates: The Complete Guide. Addison-Wesley Professional.
[48]
Wadler, P. & Blott, S. (1989) How to make ad-hoc polymorphism less ad hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1989:). ACM Press, pp. 60-76.
[49]
Willcock, J., Järvi, J., Lumsdaine, A. & Musser, D. (April 2004) A formalization of concepts for generic programming. In Concepts: a Linguistic Foundation of Generic Programming at Adobe Tech Summit. Adobe Systems.
[50]
Zalewski, M., Priesnitz, A., Ionescu, C., Botta, N. & Schupp, S. (2007) Multi-language library development: From Haskell type classes to C++ concepts. In Multiparadigm Programming with Object-Oriented Languages: MPOOL 2007.

Cited By

View all
  • (2012)From HOT to COOLProceedings of the Twelfth Workshop on Language Descriptions, Tools, and Applications10.1145/2427048.2427051(1-7)Online publication date: 31-Mar-2012
  • (2011)ConceptClangProceedings of the seventh ACM SIGPLAN workshop on Generic programming10.1145/2036918.2036929(71-82)Online publication date: 18-Sep-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
  1. Generic programming with c++ concepts and haskell type classes: A comparison

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image Journal of Functional Programming
    Journal of Functional Programming  Volume 20, Issue 3-4
    July 2010
    210 pages

    Publisher

    Cambridge University Press

    United States

    Publication History

    Published: 01 July 2010

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 12 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2012)From HOT to COOLProceedings of the Twelfth Workshop on Language Descriptions, Tools, and Applications10.1145/2427048.2427051(1-7)Online publication date: 31-Mar-2012
    • (2011)ConceptClangProceedings of the seventh ACM SIGPLAN workshop on Generic programming10.1145/2036918.2036929(71-82)Online publication date: 18-Sep-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

    View Options

    View options

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media