ts-belt icon indicating copy to clipboard operation
ts-belt copied to clipboard

Support for asynchronous operations

Open jsec opened this issue 2 years ago • 7 comments

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.

jsec avatar Jun 18 '22 03:06 jsec

+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.

WidgetKing avatar Aug 06 '22 00:08 WidgetKing

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

alexn-s avatar Aug 25 '22 10:08 alexn-s

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

  • Async (equivalent to fp-ts Task)
  • AsyncResult (TaskEither)
  • AsyncData

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)

mobily avatar Aug 26 '22 17:08 mobily

How long till this will be published ?👌

stychu avatar Oct 16 '22 09:10 stychu

@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!

mobily avatar Oct 21 '22 19:10 mobily

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.

WidgetKing avatar Oct 22 '22 13:10 WidgetKing

@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 🚀

mobily avatar Nov 02 '22 19:11 mobily