TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

FxTS – A functional and using lazy evaluation and concurrency for JavaScript/TS

4 pointsby xodltusover 3 years ago

1 comment

xodltusover 3 years ago
There are already good functional programming libraries in the JS&#x2F;TS ecosystem, but FxTS has the following advantages:<p>1. Lazy-evaluation Many functions in FxTS handle AsyncIterables and Iterables well and are designed to default to lazy evaluation. And since it operates only with a combination of functions that return standard `Iterable` and `AsyncIterable` without creating a separate wrapper object for lazy evaluation, the composability of the code is higher.<p>2. Easy and declarative asynchronous programming FxTS is designed to make it easier to control asynchronous programming, especially concurrency, declaratively. For example) <a href="https:&#x2F;&#x2F;codesandbox.io&#x2F;s&#x2F;fxts-example-ofm0b?file=&#x2F;src&#x2F;index.ts" rel="nofollow">https:&#x2F;&#x2F;codesandbox.io&#x2F;s&#x2F;fxts-example-ofm0b?file=&#x2F;src&#x2F;index....</a><p>3. Type Inference As in the example code above, we have made good type inference even if we synthesize functions that deal with `AsyncIterable` and `Iterable`. In the example code above, the value returned by pipe is inferred well as an `Array&lt;number&gt;` type, and type inference works well even when several functions that change types are combined.<p>4. Error handling FxTS considers not only the compile time of TypeScript, but also usability at runtime after conversion to JavaScript as important. Because it propagates errors according to the ECMAScript standard, you can easily handle errors with try-catch and await+try-catch, and it is good to use with Sentry or various 3rd party error logging and debugging tools.