hs-bindgen
Handy macro to generate C-FFI bindings from Rust to Haskell.
This library intended to work best in a project configured by
cabal-pack
.
Examples
A minimal example would be to have a function annoted like this:
use *;
/// Declare targeted Haskell signature
This will be expanded to (you can try yourself with cargo expand
):
use *;
// Mangling randomize symbols
extern "C"
A more complete example, when we now try to pass a custom type to our interface:
use ;
/// A custom Rust data-type
/// Implementation of the helper trait require by `hs_bindgen`
Acknowledgments
⚠️ This is still a working experiment, not yet production ready.
hs-bindgen
was heavily inspired by other interoperability initiatives, as
wasm-bindgen
and
PyO3
.
This project was part of a work assignment as an IOG contractor.