ABSTRACT
We describe deriving, a system of extensible generic functions for OCaml implemented as a preprocessor and supporting library. We argue that generating code from type-definitions has significant advantages over a combinator approach, taking serialisation as an example application: our generate-your-boilerplate design results in a system that is easy to use, has comprehensive coverage of types and handles cyclic values without imposing a burden on the user. Users can extend generic functions with specialised implementations at particular types; we show how this can lead to dramatically improved performance in the serialisation task without the user writing a single line of serialisation code.
- John Billings and Peter Sewell and Mark Shinwell and Rok Strniaš Type-safe distributed programming for OCaml MCM SIGPLAN Workshop on ML, 2006. Google ScholarDigital Library
- Jacques Carette, Lydia E. van Dijk and Oleg Kiselyov. Syntactic extension for Monads in Ocaml. http://www.cas.mcmaster.ca/~carette/pa_monad/.Google Scholar
- James Cheney and Ralf Hinze. A lightweight implementation of generics and dynamics. Haskell Workshop, 2002. Google ScholarDigital Library
- Albert Cohen and C. Herrmann. Towards a High-Productivity and High-Performance Marshaling Library for Compound Data. 2nd MetaOCaml Workshop, 2005.Google Scholar
- Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. Links: Web Programming Without Tiers. FMCO, 2006. Google ScholarDigital Library
- Derek Dreyer, Robert Harper, Manuel Chakravarti, and Gabriele Keller. Modular Type Classes. POPL, 2007. Google ScholarDigital Library
- Martin Elsman. Type-Specialized Serialization with Sharing. Trends in Functional Programming, 2005.Google Scholar
- Andrzej Filinski. Controlling Effects. PhD Thesis, School of Computer Science, Carnegie Mellon University, May 1996.Google Scholar
- Jacques Garrigue. Programming with Polymorphic Variants. ML Workshop, 1998.Google Scholar
- Jeremy Gibbons. Design patterns as higher-order datatype-generic programs. Workshop on Generic Programming, 2006. Google ScholarDigital Library
- Ralf Hinze, Johan Jeuring, and Andres Löh. Comparing approaches to generic programming in Haskell. Spring School on Datatype-Generic Programming, 2006. Google ScholarDigital Library
- Ralf Hinze. Generics for the masses. ICFP, 2004. Google ScholarDigital Library
- Ralf Hinze, Andres Löh, and Bruno C. d. S. Oliveira. "Scrap Your Boilerplate" Reloaded FLOPS, 2006. Google ScholarDigital Library
- John Hughes. Why Functional Programming Matters. Computer Journal, 32(2), 1989. Google ScholarDigital Library
- Martin Jambon. json-static. http://martin.jambon.free.fr/json-static.html.Google Scholar
- Martin Jambon. pa tryfinally. http://martin.jambon.free.fr/pa_tryfinally.ml.Google Scholar
- Patrik Jansson and Johan Jeuring. PolyP -- a polytypic programming language extension. POPL, 1997. Google ScholarDigital Library
- Vesa Karvonen. Generics for the Working ML'er. ML Workshop, 2007. Google ScholarDigital Library
- R. Kelsey, W. Clinger, J. Rees (eds.). Revised5 Report on the Algorithmic Language Scheme. Higher-Order and Symbolic Computation, 11(1), 1998. Google ScholarDigital Library
- Andrew J. Kennedy. Functional Pearl: Pickler Combinators. JFP, 14(6), 2004. Google ScholarDigital Library
- Oleg Kiselyov. Post to Haskell list, August 2004. http://haskell.org/pipermail/haskell/2004-August/014463.htmlGoogle Scholar
- Ralf Lämmel and Simon Peyton-Jones. Scrap your boilerplate: a practical design pattern for generic programming. TLDI, 2003.Google ScholarDigital Library
- Chuck Liang and Gopalan Nadathur. Tradeoffs in the Intensional Representation of Lambda Terms. RTA, 2002. Google ScholarDigital Library
- Neil Mitchell and Stefan O'Rear. Derive. http://www-users.cs.york.ac.uk/~ndm/derive/.Google Scholar
- Simon Peyton Jones and John Hughes (editors). Haskell 98: A Non-strict, Purely Functional Language. February, 1999.Google Scholar
- Daniel de Rauglaudre. IoXML. http://cristal.inria.fr/~ddr/IoXML/.Google Scholar
- Martin Sandin. Tywith. http://tools.assembla.com/tywith/wiki.Google Scholar
- Guido Tack, Leif Kornstaedt and Gert Smolka. Generic Pickling and Minimization. ML Workshop, 2005.Google Scholar
- Philip Wadler The essence of functional programming. POPL, 1992. Google ScholarDigital Library
- Stefan Wehr. ML Modules and Haskell Type Classes: A Constructive Comparison. Master's thesis, Albert-Ludwigs-Universität, Freiburg, Germany, November 2005.Google Scholar
- Stephanie Weirich. RepLib: A library for derivable type classes. Haskell Workshop, 2006. Google ScholarDigital Library
- Noel Winstanley. DrIFT. http://repetae.net/~john/computer/haskell/DrIFT/.Google Scholar
- Programming languages - C. ISO/IEC 9899:1999.Google Scholar
- American National Standard for Programming Language Common LISP. ANSI X3.226:1994. J13/SC22/WG16 Common LISPGoogle Scholar
Index Terms
- Practical generic programming in OCaml
Recommendations
Usage of generic programming on hackage: experience report
WGP '13: Proceedings of the 9th ACM SIGPLAN workshop on Generic programmingGeneric programming language constructs, tools and libraries have been available in Haskell since the first report on the programming language Haskell. At the beginning of the 1990s generic programming techniques could be used via the deriving construct,...
Generic programming in Fortran
PEPM '06: Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulationParametric Fortran is an extension of Fortran that supports the construction of generic programs by allowing the parameterization of arbitrary Fortran constructs. A parameterized Fortran program can be translated into a regular Fortran program guided by ...
A comparative study of language support for generic programming
OOPSLA '03: Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applicationsMany modern programming languages support basic generic programming, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support to a broader, more powerful interpretation of generic programming, and ...
Comments