Abstract
The interfacing of object-oriented languages with functional languages, in general, and with Haskell, in particular, has received a considerable amount of attention. Previous work, including Lambada, a Haskell to Java bridge, showed how an object-oriented class hierarchy can be modeled using Haskell type classes, such that Java libraries can be used conveniently from Haskell.
The present paper extends this previous work in two major directions. Firstly, we describe a new implementation of object-oriented style method calls and overloading in Haskell, using multi-parameter type classes and functional dependencies. This enables calling of a foreign object’s methods in a syntactically convenient, type-safe manner. Secondly, we sketch an approach to automating the generation of library bindings using compile-time meta-programming for object-oriented frameworks featuring reflection. We have evaluated the practicality of our approach by implementing a Haskell binding to the Objective-C language on the Mac OS X platform.
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
Simon Peyton Jones, M.J., Meijer, E.: Type classes: exploring the design space. In: Haskell Workshop (1997)
Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 230. Springer, Heidelberg (2000)
Sheard, T., Peyton Jones, S.: Template meta-programming for haskell. In: Proceedings of the Haskell Workshop (2002)
Meijer, E., Finne, S.: Lambada: Haskell as a better Java. Electronic Notes in Theoretical Computer Science 41(1) (2001)
Shields, M., Peyton Jones, S.: Object-oriented style overloading for Haskell. In: First Workshop on Multi-language Inferastructure and Interoperability (BABEL 2001), Firenze, Italy (2001)
Leijen, D., Meijer, E., Hook, J.: Haskell as an automation controller. In: Advanced Functional Programming, pp. 268–289 (1998)
Finne, S., Leijen, D., Meijer, E., Jones, S.P.: Calling hell from heaven and heaven from hell. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming, ACM Press, New York (1999)
Peyton Jones, S., Meijer, E., Leijen, D.: Scripting COM components in Haskell. In: Proceedings of the Fifth International Conference on Software Reuse, IEEE Computer Society, Los Alamitos (1998)
Finne, S., Leijen, D., Meijer, E., Peyton Jones, S.L.: H/Direct: A binary foreign language interface for Haskell. In: Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP 1998), pp. 153–162. ACM Press, New York (1998)
Courtney, A.: GCJNI (2002), http://haskell.cs.yale.edu/gcjni/
Yakeley, A.: Haskell/Java VM Bridge (2003), http://sourceforge.net/projects/jvm-bridge/
Nordin, T., Peyton Jones, S.L., Reid, A.: Green Card: a foreign-language interface for Haskell. In: Proceedings of the Haskell Workshop (1997)
Chakravarty, M.M.T.: C→Haskell, or yet another interfacing tool. In: Koopman, P., Clack, C. (eds.) IFL 1999. LNCS, vol. 1868, Springer, Heidelberg (2000)
The GHC Team: The Glasgow Haskell Compiler user’s guide: Writing Haskell interfaces to C code: hsc2hs (2001), http://www.haskell.org/ghc/docs/latest/html/users_guide/hsc2hs.html
Reid, A.: Template Greencard (draft). In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, Springer, Heidelberg (2004)
The Haskell FFI Team: A primitive foreign function interface (1998), http://www.cse.unsw.edu.au/~chak/haskell/ffi/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pang, A.T.H., Chakravarty, M.M.T. (2004). Interfacing Haskell with Object-Oriented Languages. In: Trinder, P., Michaelson, G.J., Peña, R. (eds) Implementation of Functional Languages. IFL 2003. Lecture Notes in Computer Science, vol 3145. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27861-0_2
Download citation
DOI: https://doi.org/10.1007/978-3-540-27861-0_2
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-23727-3
Online ISBN: 978-3-540-27861-0
eBook Packages: Computer ScienceComputer Science (R0)