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 annotated like this:
use *;
/// Haskell type signature are auto-magically inferred from Rust function
/// type! This feature could slow down compilation and be disabled with:
/// `hs-bindgen = { ..., default-features = false }`
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
/// Declare targeted Haskell signature
/// Implementation of the helper trait required 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.