Re:Type-safe GraphQL with OCaml
by apatil on Thursday November 30, 2017 @03:26PM
(#15819202)
I wish OCaml could just use the libraries of Go and Rust. They can both compile to object files, and their type systems can be mostly modelled in OCaml's.
[ Parent
| on HN ]
OCaml can call external libraries via FFi functionality. I've only done this with Bucklescript (which makes it easy, the JS doesn't need to be compiled) though RWO walks through binding a C library: https://realworldocaml.org/v1/en/html/foreign-function-inter.... Wonder if this could be used with the go/rust compiler?
It's definitely possible today, I just wish it were closer to seamless. For example, it seems like it would be possible to write a utility that takes a Go source file and emits a .cma, and maybe an .mli so you can see what's in there.