mobily / ts-belt

🔧 Fast, modern, and practical utility library for FP in TypeScript.
https://mobily.github.io/ts-belt
MIT License
1.11k stars 31 forks source link

Support for asynchronous operations #36

Open jsec opened 2 years ago

jsec commented 2 years ago

Hey there, loving the library thus far.

I was wondering if pipe and flow support async functions without needing to wrap them in an IIFE. Purify supports this via their MaybeAsync and EitherAsync wrappers, and I believe Ramda also supports this via the composeWith and pipeWith functions.

I'm currently evaluating replacing Ramda with either this library or Purify, but to reduce the amount of churn, being able to support async ops in a composition is ideal.

WidgetKing commented 2 years ago

+1 from me.

My personal preference for this would be a third kind of monad. A ts-belt equivalent of fp-ts's TaskEither would plug what at least to me feels like a major hole.

alexn-s commented 2 years ago

i just looked for alternatives for fp-ts and about 1/3 of my code is async (playwright, puppeteer, ...) and i need a TaskEither equivalent. sadly purify-ts does not have compose/ flow/ pipe functions but async support. a mix between ts-belt and purify would be quite awesome.

besides that i really like ts-belt. it is intuitive and not as cumbersome & overkill as fp-ts

mobily commented 2 years ago

@jsec @WidgetKing @alexn-s hey there! 👋 this is definitely on my roadmap, sneak peek: I'm currently working on three following modules:

all of them will be published in one of the subsequent releases (it takes a vast amount of time to adjust ReScript to TS in this particular case tho)

stychu commented 2 years ago

How long till this will be published ?👌

mobily commented 2 years ago

@stychu I suppose it will be published by the end of this month, the implementation of all Async modules is done (tested internally on a mid-sized project), and at the moment I'm working on a brand new documentation site :) sorry, that you need to wait for a new version so long!

WidgetKing commented 2 years ago

Thanks for the update @mobily! And thank you for all the time and effort you put into this library. Take your time. We know good things come to those who wait.

mobily commented 1 year ago

@stychu @alexn-s @jsec @WidgetKing I suggest reading the following issue: https://github.com/mobily/ts-belt/issues/51 still working on the docs, nevertheless, I feel the next version is ready for wider testing 🚀