Description
I've been playing with making a WebAssembly solver for the Elm ecosystem, with the aim of it being easily usable for tooling written in JavaScript. The wasm API I've settled on for the time being looks like this:
let wasm = require("elm-solve-deps-wasm");
let solution = wasm.solve_deps(
rootPackage,
fetchDependencies, // function
listVersions // function
);
It works fine but requires that the fetchDependencies
and listVersions
functions passed as argument are sync. However, in the NodeJS ecosystem, reading files and making http requests is mainly done with async. So this API forces the user to use sync versions of file IO, which is fine, and sync versions of http requests which is a bit more annoying to do.
In order to be able to write those two functions with async, it means we also need an async version of the DependencyProvider
trait, where getDependencies
and choosePackageVersion
would return futures instead of normal values. I'm not sure if it's easily done, because async and traits are quite painful together from some of my readings, but I wanted to raise this use case.