Interfacing Haskell to Object-Oriented Languages
AndrÈ T. H. Pang and Manuel M. T. Chakravarty
In Greg Michaelson and Phil Trinder, editors, IFL 2003 - 15th International Workshop on the Implementation of Functional Languages, LNCS, Springer-Verlag, 2004.
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.
Download
16 pages: Postscript (.ps.gz), Adobe Acrobat PDF. The copyright for the papers is held by the authors or by the publisher. The papers are provided for personal use only; other use requires the explicit permission of the copyright holder.