Abstract
Interface types are a useful concept in object-oriented programming languages like Java or C#. A clean programming style advocates relying on interfaces without revealing their implementation.
Haskell’s type classes provide a closely related facility for stating an interface separately from its implementation. However, there are situations in which no simple mechanism exists to hide the identity of the implementation type of a type class. This work provides such a mechanism through the integration of lightweight interface types into Haskell.
The extension is non-intrusive as no additional syntax is needed and no existing programs are affected. The implementation extends the treatment of higher-rank polymorphism in production Haskell compilers.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Bruce, K.B., Petersen, L., Fiech, A.: Subtyping is not a good ”match” for object-oriented languages. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 104–127. Springer, Heidelberg (1997)
Diatchki, I.S., Jones, M.P.: Strongly typed memory areas programming systems-level data structures in a functional language. In: Löh, A. (ed.) Proceedings of the 2006 ACM SIGPLAN Haskell Workshop, Portland, Oregon, USA, pp. 72–83 (September 2006)
GHC. The Glasgow Haskell compiler (2008), http://www.haskell.org/ghc/
Goerzen, J.: Haskell database connectivity (2008), http://software.complete.org/software/projects/show/hdbc
Hugs 98 (2003), http://www.haskell.org/hugs/
Jones, M.P.: Qualified Types: Theory and Practice. Cambridge University Press, Cambridge (1994)
Jones, M.P.: First-class polymorphism with type inference. In: Jones, N. (ed.) Proc. 1997 ACM Symp. POPL, Paris, France, January 1997, pp. 483–496. ACM Press, New York (1997)
Le Botlan, D., Rémy, D.: MLF: raising ML to the power of System F. In: Shivers, O. (ed.) Proc. ICFP 2003, Uppsala, Sweden, August 2003, pp. 27–38. ACM Press, New York (2003)
Leijen, D.: HMF: Simple type inference for first-class polymorphism. In: ICFP, pp. 283–293. ACM Press, New York (2008)
Leijen, D., Lóh, A.: Qualified types for MLF. In: Pierce [15], pp. 144–155
Läufer, K.: Type classes with existential types. J. Funct. Program. 6(3), 485–517 (1996)
Odersky, M., Läufer, K.: Putting type annotations to work. In: Proc. 1996 ACM Symp. POPL, St. Petersburg, FL, USA, January 1996, pp. 54–67. ACM Press, New York (1996)
Oliveira, B., Sulzmann, M.: Objects to unify type classes and GADTs (April 2008), http://www.cs.mu.oz.au/~sulzmann/manuscript/objects-unify-type-classes-gadts.ps
Peyton Jones, S., Vytiniotis, D., Weirich, S., Shields, M.: Practical type inference for arbitrary-rank types. J. Funct. Program. 17(1), 1–82 (2007)
Pierce, B.C. (ed.): ICFP, Tallinn, Estonia. ACM Press, New York (2005)
PostgreSQL, the most advanced Open Source database system in the world (2008), http://www.postgresql.org
Russo, C.V.: First-class structures for Standard ML. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 336–350. Springer, Heidelberg (2000)
Rémy, D.: Simple, partial type-inference for System F based on type-containment. In: Pierce [15], pp. 130–143
Tofte, M.: Essentials of Standard ML Modules. In: Advanced Functional Programming, pp. 208–238. Springer, Heidelberg (1996)
Vytiniotis, D., Weirich, S., Peyton Jones, S.: Boxy types: Inference for higher-rank types and impredicativity. In: Lawall, J. (ed.) Proc. ICFP 2006, Portland, Oregon, USA, Sep. 2006, pp. 251–262. ACM Press, New York (2006)
Vytiniotis, D., Weirich, S., Peyton Jones, S.: FPH: First-class polymorphism for Haskell. In: ICFP (to appear, 2008), http://www.cis.upenn.edu/~dimitriv/fph/
Wehr, S., Lämmel, R., Thiemann, P.: JavaGI: Generalized interfaces for Java. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 347–372. Springer, Heidelberg (2007)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Thiemann, P., Wehr, S. (2008). Interface Types for Haskell. In: Ramalingam, G. (eds) Programming Languages and Systems. APLAS 2008. Lecture Notes in Computer Science, vol 5356. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-89330-1_19
Download citation
DOI: https://doi.org/10.1007/978-3-540-89330-1_19
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-89329-5
Online ISBN: 978-3-540-89330-1
eBook Packages: Computer ScienceComputer Science (R0)