xvaldetaro / purescript-hyrule-paraglider

Explore Hyrule with of Paraglider Rx-inpired operators
6 stars 0 forks source link

Proposal: create a file Rx that has all of the Rx interop #2

Closed mikesol closed 2 years ago

mikesol commented 2 years ago

One of the great features of this lib IMO is its ability to provide a gentle entry into the PS ecosystem through Rx-like synatx.

hyrule has its own naming conventions that date back to the original author's work in 2014, and a lot of the subsequent functions use idiosyncratic naming and patterns that stem from our community's take on FRP. As a result, a voice has emerged that's distinctly different than Rx & that merits exploration in its own right, but it's also good to have a one-stop shop in Rx.purs where we translate these concepts to Rx. That separation will also lead us to consider which abstractions are leaky in which vocabulary, which things are more ergonomic in one framework versus the other, etc.

Ideally, the whole suite of Rx operators can be implemented backed by hyrule and paraglider primitves. It's a tall order, but perhaps feasible?

xvaldetaro commented 2 years ago

I think I added all the operators that I regularly use from RxJava that make sense in JS/PS for now. Most of the other ones I either never used, or are no applicable without multithreading or other RxJava specifics like backpressure and Single.

About the separation. If we only keep Rx stuff in paraglider then auxiliary useful stuff like mailboxed for example would have to stay in hyrule because it doesn't have an analog in Rx. Or we could have separate folders/files for Rx translated ones vs Hyrule only stuff. Wdyt?

mikesol commented 2 years ago

I put some ideas in https://github.com/xvaldetaro/purescript-hyrule-paraglider/issues/1 as there's overlap between the two issues.

The only small thing I'd point out here is that it's possible to deal with backpressure in hyrule via fix, which can be used to implement debounce, differential equations, and basically anything that treats a stream like a fluid. There's already some of this (ie a debounce, derivative and integral function) in hyrule that were written way back when by the original author before he left the project.