C \(\longrightarrow\) HASKELL, or Yet Another Interfacing Tool

  • Manuel M. T. Chakravarty
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1868)

Abstract

This paper discusses a new method for typed functional languages to access libraries written in a lower-level language. More specifically, it introduces an interfacing tool that eases Haskell access to C libraries. The tool obtains information about the C data type definitions and function signatures by analysing the C header files of the library. It uses this information to compute the missing details in the template of a Haskell module that implements a Haskell binding to the C library. Hooks embedded in the binding file signal where, which, and how C objects are accessed from Haskell. The Haskell code in the binding file determines Haskell type signatures and marshaling details. The approach is lightweight and does not require an extra interface description language.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Beazley, D.M.: SWIG and automated C/C++ scripting. Dr. Dobb’s Journal (February 1998)Google Scholar
  2. 2.
    Chakravarty, M.M.T.: A compiler toolkit in Haskell (1999), http://www.cse.unsw.edu.au/~chak/haskell/ctk/
  3. 3.
    Chakravarty, M.M.T.: A GTK+ binding for Haskell (1999), http://www.cse.unsw.edu.au/~chak/haskell/gtk/
  4. 4.
    Chakravarty, M.M.T.: Lazy lexing is fast. In: Middeldorp, A., Sato, T. (eds.) Proceedings of the 4th Fuji International Symposium on Functional and Logic Programming. LNCS. Springer, Heidelberg (1999)Google Scholar
  5. 5.
    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)Google Scholar
  6. 6.
    Finne, S., Leijen, D., Meijer, E., Jones, S.L.P.: 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)Google Scholar
  7. 7.
    Harlow, E.: Developing Linux. Applications with GTK+ and GDK. New Riders Publishing, Indianapolis (1999)Google Scholar
  8. 8.
    Jones, S.P., Marlow, S., Elliott, C.: Stretching the storage manager: Weak pointers and stables names in Haskell. In: Proceedings of the International Conference on Functional Programming (1999)Google Scholar
  9. 9.
    Nordin, T., Jones, S.L.P., Reid, A.: Green Card: a foreign-language interface for Haskell. In: Proceedings of the Haskell Workshop (1997)Google Scholar
  10. 10.
    The common object request broker: Architecture and specification, rev. 2.2. Technical report, Object Management Group, Framingham, MA (1998)Google Scholar
  11. 11.
    Pennington, H.: GTK+/Gnome Application Development. New Riders Publishing, Indianapolis (1999)Google Scholar
  12. 12.
    Jones, S.L.P., Wadler, P.: Imperative functional programming. In: ACM Symposium on Principles of Programming Languages, pp. 71–84. ACM Press, New York (1993)CrossRefGoogle Scholar
  13. 13.
    Haskell 98: A non-strict, purely functional language (February 1999), http://haskell.org/definition/
  14. 14.
    Swierstra, S.D., Duponcheel, L.: Deterministic, error-correcting combinator parsers. In: Launchbury, J., Sheard, T., Meijer, E. (eds.) AFP 1996. LNCS, vol. 1129, pp. 184–207. Springer, Heidelberg (1996)Google Scholar
  15. 15.
    The Haskell FFI Team. A primitive foreign function interface (1998), http://www.dcs.gla.ac.uk/fp/software/hdirect/ffi.html

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Manuel M. T. Chakravarty
    • 1
  1. 1.School of Computer Science and EngineeringUniversity of New South WalesSydney

Personalised recommendations