|
ABSTRACT
Datatype-generic programming involves parametrization by the shape of data, in the form of type constructors such as "list of". Most approaches to datatype-generic programming are developed in the lazy functional programming language Haskell. We argue that the functional object-oriented language Scala is in many ways a better setting. Not only does Scala provide equivalents of all the necessary functional programming features (such parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). We show how this combination of features benefits datatype-generic programming, using three different approaches as illustrations.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
P. Buchlovsky and H. Thielecke. A type-theoretic reconstruction of the Visitor pattern. In Mathematical Foundations of Programming Semantics, 2005.
|
 |
3
|
|
| |
4
|
R. Cockett and T. Fukushima. About Charity. Department of Computer Science, University of Calgary, May 1992.
|
| |
5
|
|
| |
6
|
A. Dijkstra and S. D. Swierstra. Making implicit parameters explicit. Technical Report UU-CS-2005-032, Department of Information and Computing Sciences, Utrecht University, 2005.
|
| |
7
|
J. Garrigue. Code reuse through polymorphic variants. In Workshop on Foundations of Software Engineering, Sasaguri, Japan, 2000.
|
 |
8
|
|
| |
9
|
J. Gibbons and B. C. d. S. Oliveira. The essence of the Iterator pattern. Journal of Functional Programming, 2008.
|
 |
10
|
|
 |
11
|
|
| |
12
|
|
| |
13
|
R. Hinze and J. Jeuring. Generic Haskell: Practice and theory. In LNCS 2793: Summer School on Generic Programming, Berlin, 2002.
|
| |
14
|
R. Hinze and A. Löh. Generic programming, now! In LNCS 4719: Datatype-Generic Programming, 2007.
|
| |
15
|
R. Hinze and S. Peyton Jones. Derivable type classes. In Haskell Workshop, 2000.
|
| |
16
|
R. Hinze, A. Löh, and B. C. d. S. Oliveira. "Scrap your Boilerplate" reloaded. In Functional and Logic Programming, 2006.
|
| |
17
|
W. Kahl and J. Scheffczyk. Named instances for Haskell type classes. In Haskell Workshop, 2001.
|
 |
18
|
|
 |
19
|
|
 |
20
|
Xavier Leroy, Manifest types, modules, and separate compilation, Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.109-122, January 16-19, 1994, Portland, Oregon, United States
[doi> 10.1145/174675.176926]
|
| |
21
|
|
| |
22
|
A. Löh. Exploring Generic Haskell. PhD thesis, Utrecht University, 2004.
|
 |
23
|
|
| |
24
|
|
| |
25
|
L. Meertens. Paramorphisms. Formal Aspects of Computing, 4 (5): 413--425, 1992.
|
| |
26
|
|
| |
27
|
A. Moors. Code-follows-type programming in Scala. http://www.cs.kuleuven.be/~adriaan/?q=cft_intro, June 2007.
|
 |
28
|
|
 |
29
|
|
| |
30
|
M. Odersky. An Overview of the Scala programming language (second edition). Technical Report IC/2006/001, EPFL Lausanne, Switzerland, 2006\natexlaba.
|
| |
31
|
M. Odersky. Poor man's type classes. http://lamp.epfl.ch/~odersky/talks/wg2.8-boston06.pdf, July 2006.
|
| |
32
|
M. Odersky. Scala by example. http://scala.epfl.ch/docu/files/ScalaIntro.pdf, May 2007.
|
| |
33
|
M. Odersky. The Scala language specification version 2.4. http://scala.epfl.ch/docu/files/ScalaReference.pdf, May 2007.
|
 |
34
|
|
 |
35
|
Martin Odersky , Matthias Zenger, Scalable component abstractions, Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, October 16-20, 2005, San Diego, CA, USA
|
| |
36
|
B. C. d. S. Oliveira. Genericity, Extensibility and Type-Safety in the Visitor Pattern. PhD thesis, University of Oxford, 2007.
|
 |
37
|
|
| |
38
|
B. C. d. S. Oliveira and M. Sulzmann. Objects to unify type classes and GADTs. http://www.comlab.ox.ac.uk/people/Bruno.Oliveira/objects.pdf, Apr. 2008.
|
| |
39
|
B. C. d. S. Oliveira, R. Hinze, and A. Löh. Extensible and modular generics for the masses. In Trends in Functional Programming, pages 109--138, Apr. 2006.
|
 |
40
|
Simon Peyton Jones , Dimitrios Vytiniotis , Stephanie Weirich , Geoffrey Washburn, Simple unification-based type inference for GADTs, Proceedings of the eleventh ACM SIGPLAN international conference on Functional programming, September 16-21, 2006, Portland, Oregon, USA
|
| |
41
|
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 UU-CS-2008-010, Utrecht University, 2008.
|
| |
42
|
N. Schärli, S. Ducasse, O. Nierstrasz, and A. Black. Traits: Composable units of behavior. In LNCS 2743: European Conference on Object-Oriented Programming, pages 248--274, July 2003.
|
| |
43
|
M. Schinz. A Scala tutorial for Java programmers. http://scala.epfl.ch/docu/files/ScalaTutorial.pdf, May 2007.
|
 |
44
|
|
| |
45
|
P. Wadler. Monads for functional programming. In Program Design Calculi. Springer-Verlag, 1993.
|
| |
46
|
P. Wadler. The expression problem. Java Genericity Mailing list, Nov. 1998. URL http://www.cse.ohio-state.edu/~gb/cis888.07g/java-genericity/20.
|
| |
47
|
G. Washburn. Revisiting higher-rank impredicative polymorphism in Scala. http://existentialtype.net/2008/05/26/revisiting-higher-rank-impredicat%ive-polymorphism-in-scala/, May 2008.
|
 |
48
|
|
|