Crates.io | ghc-rts-rs |
lib.rs | ghc-rts-rs |
version | 0.0.1 |
source | src |
created_at | 2018-01-25 20:48:05.239106 |
updated_at | 2018-01-25 20:48:05.239106 |
description | Link in the Haskell Runtime to run Haskell inside Rust |
homepage | https://github.com/mgattozzi/ghc-rts-rs |
repository | https://github.com/mgattozzi/ghc-rts-rs |
max_upload_size | |
id | 48300 |
size | 32,131 |
This is code used to link in the GHC RTS in statically to make it possible to run Haskell inside Rust. This is intended to be used as part of curryrs package as a dependency. However, it's functionality is being separated out as a base library that others can use on their own. You choose which version of GHC you want to use and the modified source files here will compile an optimized build with the correct version and DWARF symbols turned on.
It also provides wrappers around the hs_init
and hs_exit
functions so that
you can easily start and stop the runtime from your code.
Beyond this functionality the library does nothing else in order to make FFI nicer to use or simplified. If you are looking for a higher level library to make Rust/Haskell FFI easier then take a look at curryrs.
This takes an incredibly long time to build unfortunately. I would highly recommend not changing to newer versions of Rust often, meaning use stable if possible as that only changes every 6 weeks. Once compiled you shouldn't need to touch it again unless your Rust or GHC compiler changes.
extern crate ghc_rts;
use ghc_rts::{start, stop};
fn main() {
start(); // Starts the Haskell Runtime. Can be called more than once
stop(); // Stops the Runtime. Will panic if called more than once as the RTS
// can't be started again now, nor stopped.
}
You'll need the following tools installed to be able to compile the RTS:
libnuma
- Maybe. It's needed on my Linux machine. Still trying to figure
that out!cabal
ghc
You might need the static versions in order to work. For instance I needed the
ghc-static
package on Arch Linux. Play around with it to figure it out!
See CONTRIBUTING.md for more information.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.