Haskell Rust inter-operability

I don’t know much about Rust except that it seems to be in a way the “modern/functional C”, being if I understand well as fast but safer (I also know of people who defect from Haskell to Rust …)

Would it make sense for Haskell to transpile to Rust and/or have easy FFI to Rust (if it’s not already the case) or even a way of mixing both ?

1 Like

have easy FFI to Rust

Rust doesn’t have an ABI so you end up going via C anyway.

even a way of mixing both ?

Both heavily depend on build tools (Cabal/cargo) so it’s hard to have a Rust library that depends on a Haskell library that depends on a Rust library. That’s the situation for a lot of languages, unfortunately!

1 Like

Fair enough, thanks.

Here is a great article and code for binding binding to Rust in Haskell:

https://well-typed.com/blog/2023/03/purgatory/

3 Likes

It seems there is ongoing work within the Rust community to create a new higher level ABI for Rust. It’s just an RFC at this point, but if it ends up working out it would be nice if Haskell could utilize this ABI in the future in order to talk with Rust (and potentially other languages too) on a higher level than C.

2 Likes