I am happy to announce that the hs-bindgen playground is now live:
hs-bindgen creates Haskell bindings from C header files. For more information, have a look at the recent blog post about the first official release. Most features are directly available in the playground.
Feedback much appreciated!
22 Likes
This is a ridiculously cool way to demonstrate the tool. Nice work.
2 Likes
That’s really cool !
However, I tried to generate the bindings for this library : link/extensions/abl_link/include/abl_link.h at master · Ableton/link · GitHub
But nothing happens. I have to say I know nothing about Haskell FFI, so I have no idea what I’m doing, but I would expect some error message to give a hint of what went wrong ?
Sorry about that, and thanks a lot for reporting. It should work now, I managed to create bindings for your header just now!
Details about the bug:
The `hs-bindgen` playground had `LANG` unset.
hs-bindgen uses libclang to process the header, which uses UTF-8 by default. However, it also runs clang -E when reparsing some declarations to interpret macro invocations. This invocation of clang -E failed when the header contained non-ascii letters, and no LANG was set. In addition, the failure was printed to stdout, which the playground didn’t catch. Both bugs are now fixed.
There is also an upstream hs-bindgen issue so we handle an empty LANG automatically in the future: Use UTF-8 also for `clang -E`, even if the enfironment does not set it · Issue #2341 · well-typed/hs-bindgen · GitHub
2 Likes
That’s great ! Thanks a lot.