Their main page makes the product pretty clear.
I can't parse this into meaning anything:
"Reliable TypeScript for the AI era
Build production-ready systems your team can ship, customers can depend on, and AI agents can work with."
OK, it's written in TypeScript, I guess. Is it a library? What does it do?
import { Effect } from "effect"
const divide = (a: number, b: number): Effect.Effect<number, Error, never> =>
b === 0
? Effect.fail(new Error("Cannot divide by zero"))
: Effect.succeed(a / b)
Effect.runSync(divide(4, 2)) // => 2
This seems to be similar in spirit to railway oriented programming (see e.g. https://returns.readthedocs.io/en/latest/pages/railway.html), but I’m not 100% confident here. type Result e v = Ok v | Err e
https://en.wikipedia.org/wiki/Result_type> Reliable TypeScript for the AI era
It is a library.
Really reminded me of this classic pitch (and yes I know it's not the original turbo encabulator).
> More over, whenever fluorescent score motion is required it may also be employed in conjunction with a drawn reciprocation Dingle arm to reduce sinusoidal depleneration. The Retro Encabulator has now reached a high level of development and it's being successfully used in the operation of Millford Trunions. It's available soon wherever Rockwell Automation products are sold.
And if multiple people are wondering what something fundamentally is, perhaps it's the pitch, not the people.
To be fair "algebraic effects" is part of my priors. If you don't know what that is those specific words won't help you, but the examples should!
But that can't be a library? Must be a framework? (eg more batteries included)
That's not the definition of a framework.
You call a library. A framework calls you.
Anyways, I understood it as a Typescript copy of Scala's ZIO library.
Rebuild JS's core data structures: https://effect.website/docs/v4/api/effect/Array
Then rebuild the entire JS ecosystem on top of their custom data structures.
And then the main heading on their home page is "Reliable TypeScript for the AI era"? Really? I'll pass.
> Works with JavaScript arrays
a = [1, 2, 3];
foo = effect.Array.append(a, 4);
instead of using what's built in to the language? a = [1, 2, 3];
foo = [...a, 4];"Use when you need to guarantee a non-empty result after adding a required trailing value."
...whatever that means lol
a = [undefined];
res = a.pop() // undefined
a = [];
res = a.pop() // undefinedWithout the type there are a few possibilities: 1. I could forget the assertion and have buggy code without realizing. 2. I could ensure that all uses do the assertion. Even if we can statically know that it is empty. This costs us the check for every call of the function, and ends up being more code.
Alternatively I could statically know in advance. The code won't let me `Array.pop` because that is invalid, so:
1. I *cannot* make that mistake
2. It cost no runtime performance
3. It cost no extra code in a function
1: I say soft-enforce because if someone were to pass a value incorrectly cast as NonEmpty, it would still have a runtime error, but that is a bug elsewhere, not here.but they seem to want to rebuild everything, eg
> The Console service exposes common console methods such as logging, warnings, errors, groups, counters, tables, and timers. Because console access goes through a service, programs can use custom console implementations in tests or other environments. This module also includes scoped helpers that close console groups or timers automatically.
yeah idk mate
Instead, it is a case of the active users of the library saying, "Wow, the Effect way of doing this is so much nicer, can we have everything this way please?"
Console is IO and IO is the effect.
But I only read the news when it comes to npm, so maybe my fear is not justified.
If you look at Effect's package.json on GitHub[1], you'll see that they have several "devDependencies", but no regular "dependencies". That means, unless you are working on the package itself, using it does not require downloading any other packages whatsoever. Thus, Effect is not susceptible to any of the issues that you have read about in the news. The only way malicious code could be transported through the package would be if the maintainers suddenly became evil.
That being said, I don't use Effect and I think it's kind of overrated by the FP community. But, I appreciate the ideas behind it, and I felt the need to educate you about your needless fear of any library simply existing on NPM.
[0] https://unit42.paloaltonetworks.com/monitoring-npm-supply-ch...
[1] https://github.com/Effect-TS/effect/blob/main/package.json