Comments (13)
Yep, still planning to look into this in great detail :)
From the other end, there is also https://github.com/aantron/luv, for rewriting Lwt over libuv (what's used by Node internally for I/O). That's what I've spent the most time on recently.
Most recently, though, I went on a small hiatus, but planning to come back to all this soon.
from promise.
There is now a super basic POC of Repromise/Lwt interop here.
Basically, Lwt_unix (the I/O part of Lwt) drives the process I/O loop, and calls into Repromise when I/O resolves a promise and triggers a callback.
There are also two functions for converting Lwt and Repromise promises between each other.
The test case has a simple wrapper around Lwt_unix.sleep
, that turns it into a Repromise-friendly sleep
.
from promise.
Oh, very interesting, there's lots of potential for making the community more approachable here!
Thanks for all your hard work, excited to follow the progress on these!
from promise.
I think this would definitely make sense :)
My original plan was to implement the "core" of the wrapping in Repromise and/or Lwt/Async, and leave more specific things, like isomorphic HTTP clients, to other libraries that would then build over that core (for example, lwt-node
, I believe, started in that direction, cc @kennetpostigo).
I think having strong native/node/(partially browser) ecosystem compatibility would make Reason a uniquely powerful language. It should save an enormous amount of learning and development time for users.
from promise.
Hey @bobpoekert @aantron !
I'm working on these at the moment all built with reason
- Http Module
- Cross-Platform
fetch
to make network requests.
At the moment these use lwt
under the hood, but if all goes well, @aantron and I can converge on using Repromise promises. Or if repromise becomes lwt 5.0/6.0 i'd just keep depending on lwt and update w/e needs to be updated.
from promise.
@kennetpostigo How are you implementing your cross-platform fetch? Do you have converters/wrappers from bucklescript promises to lwt promises and a stripped-down version of lwt that runs on bucklescript? Or do you have some other promise type that wraps both?
from promise.
@bobpoekert js side uses what bucklescript exposes, but native side uses unix pipes
from promise.
@kennetpostigo but what's the common abstraction that cross-platform consumer code uses?
from promise.
@bobpoekert bsb-native
lets you compile to native or js. Theres a few libraries that do this like rex-json
, even repromise
uses bsb-native last I checked, among other libraries out there.
from promise.
@kennetpostigo @bobpoekert is asking, I believe, what is the underlying synchronization primitive (e.g. promise implementation) that is being compiled to native and js, that lwt-node would build its isomorphic API over.
The answer to that is, I think, that lwt-node is not there yet.
Repromise has isomorphic native/js promises, but it is not yet compatible with Lwt (or Async).
lwt-node uses Lwt right now, and so presumably is native-only for the time being.
from promise.
oh right, like I said before, right now for js we're using what bucklescript offers and for native we are using unix pipes. Theres no code sharing tho for the http client(fetch)
from promise.
Hey @aantron, this looks like a super-promising library, are there still plans for this?
Perhaps this would also be interesting from the previous discussion's perspective? https://github.com/anuragsoni/fetch/
from promise.
I'm going to close this issue to keep the repo tidy, because progress needs to be tracked in other repos that would drive Repromise:
- repromise_lwt is a Repromise/Lwt interop demo, in which the native version of Repromise is being driven by Lwt (
Lwt_engine
insideLwt_unix
). That is, Lwt plays the role of Node.js, or the browser JS runtime. - Luv is a binding to libuv, the same C async I/O library that drives Node.js. It has an example where native Repromise, driven by Luv, is doing an HTTP GET (low-level version, not fetch). It has another example of native Repromise and Lwt coexisting in one process, because both are being driven by Luv.
Even though this issue is closed, further discussion is welcome!
from promise.
Related Issues (20)
- Pipe last implementation HOT 2
- Promise.allOk and its variations HOT 6
- Add `Promise.both` HOT 2
- BuckleScript 8.0.0 breaks listToArray / Promise.all HOT 5
- Reduce compiled size again HOT 4
- Format with refmt? HOT 2
- About the deprecation of the infix operators HOT 2
- Promise.allOkArray never resolves if input is an empty array HOT 1
- Tests: remainsPending appears not to be working
- Converting from Js.Promise HOT 3
- Convert tests to OCaml syntax
- Add a js_of_ocaml variant
- Try an internal module with double underscores to hide "rejectable" from error messages
- Exceptions cause resolution with `undefined` HOT 8
- Provide type abbreviation for promises that reject with Js.Promise.error
- Convert README snippets to ReScript syntax
- Convert to ReScript syntax once there is enough adoption HOT 10
- tap on a rejected promise triggers unhandled promise rejection HOT 3
- Native Example HOT 4
- Example for reason syntax with letop
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from promise.