Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
I wrote an article on how to call C++ from Haskell: https://luctielen.com/posts/calling_cpp_from_haskell/
Feedback welcome! :smile:
pretty cool! I've done a bit of CFFI work and this looks painful in a different way :sweat_smile: but probably less than constructing a sum type from a void pointer, an enum tag and manually translated data layouts :smile:
The most work went into figuring out those techniques (like the loops) and making sure that no memory leaks/memory corruption occur (a.k.a. "who is responsible for the data").
Now you can apply this approach in a "straightforward" kind of way. :smile: But yes, it involves writing quite a bit of C++ code.. :sweat_smile:
I'm not personally going to use this, but thanks for sharing, I know how much of a pain these things can be :sweat_smile: