Re:ARM is now a fully supported target platform for GHC Haskell
by danieldk on Monday June 11, 2012 @05:49AM
(#4093855)
Fortunately, GHC can build shared libraries on some platforms, which makes it fairly easy to expose Haskell functions to C:
- Using the FFI one can specify foreign exports.
- The runtime and garbage collector can be initialized/deinitialized by adding an object file that uses gcc's constructor/destructor attributes.
- Multiple calls to hs_init (one for each library) are allowed, as long as they are balanced by hs_exits.
- It's ok to have multiple root modules.
Historically, C was used to implement many (functional) programming languages because it provided a convenient compiler back end and a well-defined intermediate representation between the front end and the back end. Not because you could compile to C and use your code from C.