Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@effect/io
Advanced tools
@effect/io is a library for building robust, type-safe, and composable applications in TypeScript. It provides a powerful set of tools for managing side effects, concurrency, and error handling in a functional programming style.
Effect Management
This feature allows you to create and manage effects, which are computations that can produce values or perform side effects. The example demonstrates creating a simple effect that succeeds with the value 42 and then running it.
const { Effect } = require('@effect/io');
const effect = Effect.succeed(42);
effect.run().then(console.log); // Outputs: 42
Error Handling
This feature provides robust error handling capabilities. The example shows how to create an effect that fails with an error and how to handle that error when running the effect.
const { Effect } = require('@effect/io');
const effect = Effect.fail(new Error('Something went wrong'));
effect.run().catch(console.error); // Outputs: Error: Something went wrong
Concurrency
This feature allows you to compose and run effects concurrently. The example demonstrates combining two effects that succeed with values 1 and 2, respectively, and running them together.
const { Effect } = require('@effect/io');
const effect1 = Effect.succeed(1);
const effect2 = Effect.succeed(2);
const combinedEffect = Effect.zip(effect1, effect2);
combinedEffect.run().then(console.log); // Outputs: [1, 2]
Resource Management
This feature provides tools for managing resources that need to be acquired and released. The example shows how to create a resource, use it in an effect, and ensure that cleanup is performed afterward.
const { Effect, Resource } = require('@effect/io');
const resource = Resource.make(
Effect.succeed('resource'),
() => Effect.succeed(console.log('cleanup'))
);
resource.use(res => Effect.succeed(console.log(res))).run(); // Outputs: 'resource' and then 'cleanup'
RxJS is a library for reactive programming using Observables, to make it easier to compose asynchronous or callback-based code. Compared to @effect/io, RxJS focuses more on reactive streams and less on effect management and resource handling.
fp-ts is a library for functional programming in TypeScript. It provides many of the same functional programming constructs as @effect/io, but it is more focused on providing a comprehensive suite of functional programming utilities rather than specifically managing effects and concurrency.
redux-saga is a library that aims to make application side effects (e.g., asynchronous actions) easier to manage, more efficient to execute, and better at handling failures. It uses generator functions to handle side effects in a Redux application. While it shares some similarities with @effect/io in terms of managing side effects, it is more tightly coupled with Redux and less general-purpose.
WIP.
0.0.66
#198 59747ea
Thanks @mikearnaldi! - Improve RuntimeFlags API
#198 4448e99
Thanks @mikearnaldi! - Expose Schedule step and initial needed for custom schedules
#198 b41507a
Thanks @mikearnaldi! - Improve Layer API
#199 7d0a9dc
Thanks @patroza! - Fix missing _tag in built-in Exceptions
#196 f1b8d74
Thanks @mikearnaldi! - Improve Deferred API
#198 a941859
Thanks @mikearnaldi! - Defer standardization of OTEL Tracer
#198 e20b27b
Thanks @mikearnaldi! - Improve Reloadable API
#198 411248e
Thanks @mikearnaldi! - Type Queue functions as Effect constructors
#201 02f1e57
Thanks @IMax153! - enhancements to Config and ConfigProvider
#194 d4fdba5
Thanks @mikearnaldi! - Improve Ref, Ref.Syncronized and ScopedRef API
#198 ed6ff39
Thanks @mikearnaldi! - Type Ref functions as Effect constructors
#198 87d2ac0
Thanks @mikearnaldi! - Type Scope functions as Effect constructors
#198 8f1c465
Thanks @mikearnaldi! - Improve FiberRefs API
#198 44f1f6e
Thanks @mikearnaldi! - Type Deferred functions as Effect constructors
#198 fa08f70
Thanks @mikearnaldi! - Improve Hub API
#198 b3b862f
Thanks @mikearnaldi! - Type FiberRef functions as Effect constructors
#198 61cf166
Thanks @mikearnaldi! - Add Layer.mergeAll
#198 46171ba
Thanks @mikearnaldi! - Improve Fiber unsafe api
#197 3af5aa3
Thanks @mikearnaldi! - Prevent tacit usage of constructors with no arguments
FAQs
Functional programming in TypeScript
The npm package @effect/io receives a total of 48,099 weekly downloads. As such, @effect/io popularity was classified as popular.
We found that @effect/io demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.