From HaskellWiki
Jump to: navigation, search

fficxx hacking at ZuriHac2015

fficxx is an automatic haskell Foreign Function Interface (FFI) generator to C++. This is used for making a haskell binding (HROOT) to ROOT analysis framework.

Although this project has potentially significant effects on haskell ecosystem, it has been stalled for a quite long time. In this hackathon, we would like to revitalize this project and attract more developers to be involved.

This document will serve as a baseline discussion of improving fficxx during and after ZuriHac 2015. Anyone who is interested can change the document or raise some issues.

We want to make some progress in the following area.

Documentation and exemplification

Binding two different worlds, FP and OOP, is not a straightforward task, so we need to have a precise model to describe OOP concept in FP language. We implemented fficxx using some typeclass-level code generation. Typeclass was especially useful due to the nature of C++ OOP model that has multiple inheritance and open-world extension. During this hackathon, we would like to provide a good amount of reading material for this matter.

Of course, providing good examples and good tutorial are very helpful and necessary. We can try to make bindings to some small C++ libraries and some practical medium-sized real-world libraries.

Modernization of codes

Currently, it uses ugly string template approach, but we would like to use clean abstract syntax tree in both haskell and C++ side. Maybe working on the C++ side is a little difficult, but on the haskell side, we can use various language-haskell libraries.

Support for pointer algebra, opaque types and templates

Currently, fficxx does not support arbitrary pointer algebra. It also defer some support for opaque types to user's responsibility. This renders fficxx a rather unusable to make bindings to some low-level libraries like OpenGL. A better inclusion of C library is needed.

The template libraries are another beast. Since supporting templates need some adjustment in haskell compilation pipeline, this need to be well-coordinated with preprocessor, ghc and cabal. We will brainstorm ideas and try to implement some basic stuff.