Effect 4.0

(effect.website)

43 points | by stevefan1999 5 hours ago ago

21 comments

  • ruby14 2 hours ago

    It’s wild how easy it is to build robust systems with Effect.

    I’m working on a little social media web app and it has been so incredibly simple to build the API and a background worker process with Effect. I get logging, telemetry, error handling, concurrency, API doc generation, and more for free!

    I think this library gets somewhat maligned for being complex, which I don’t think is fair for how much it offers given how much more complex a an equivalent solution would be without Effect.

    With v4, I also don’t feel like I am even having to wrestle with TypeScript’s type system at all. I define some basic interfaces for my services and schemas for my data models and everything is just inferred through usage for the most part. It honestly starts to feel like I’m writing JavaScript for the most part.

    This library gets lots of comparisons to functional programming languages/libraries, which is fair, but I think someone working in .NET/C# would be feel right at home.

  • chrysoprace 14 minutes ago

    Is there a way to implement Effect without it becoming a leaky abstraction that takes over your whole app? Presumably you'd have to create an entire abstraction layer with strict boundaries, such as nestjs does with RxJS Observables, but even that has problems with leaking Observables when you need to hook into the framework's lifecycle.

  • claude-ai 5 hours ago

    Three clicks, no info what effect 4.0 is, except that it's AI-ready, safe, good, and re-built from the ground up. No idea what it actually is.

    • vantassell 2 hours ago

      I had the same thought, until I realized the posted link is for their 4.0 release rather than their homepage.

      Their main page makes the product pretty clear.

      https://effect.website

      • pohl an hour ago

        Still can’t tell if it’s a language, library or framework

        • itishappy an hour ago

          Have you tried reading the big bold text at the top of the page?

          > Reliable TypeScript for the AI era

          It is a library.

    • miguel-muniz 2 hours ago

      Sometimes I use the wayback machine to visit marketing pages before the advent of AI, so I can get a better understanding of what they actually do instead of just a bunch of AI jargon.

    • slopinthebag 3 hours ago

      it's for people who want to write ocaml or rust, but in typescript for some reason

      • nvme0n1p1 2 hours ago

        It does seem like they're boiling the ocean, for... whatever reason programmers do these things.

        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.

        • maleldil 2 hours ago

          It literally says:

          > Works with JavaScript arrays

          • nvme0n1p1 2 hours ago

            Yes but why? Why should I import a giant dependency to do this:

              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];
            • slopinthebag 2 hours ago

              did you read the docs? it says

              "Use when you need to guarantee a non-empty result after adding a required trailing value."

              ...whatever that means lol

        • slopinthebag 2 hours ago

          part of it is because js is a throwing language, and since there are no "checked" exceptions they need to basically rebuild the universe in their paradigm.

          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

    • verdverm 5 hours ago

      fiber/effects for UI and event bus, eg. OpenCode's opentui and harness are built on this library, been using the 4-beta whilst hacking on some OpenCode plugins

    • amelius 2 hours ago

      It's made with Npm, which makes me wonder if it's really safe ...

      But I only read the news when it comes to npm, so maybe my fear is not justified.

      • tiagod an hour ago

        What do you mean by "made with npm"?

  • sibeliuss an hour ago

    It is hard to understand why one would want to introduce this into their codebase given how functional javascript is right away. It lives in the spectrum of rxjs - super powerful, but is it necessary? Can all of those concepts be distilled down into what you would use on the day to day (just a few), with less concept density, and just as much functional goodness?

    • itishappy 16 minutes ago

      Try it out! Translate a few of the privatives and then see what happens when you try composing a few different ones.

  • 2001zhaozhao an hour ago

    Is this like a spring boot for typescript or something like that? Looks kind of interesting

    • theflyinghorse 14 minutes ago

      It's like Scala and Spring Boot had a baby and the baby was in typescript. Super solid project great engineers.

  • jauntywundrkind 26 minutes ago

    I can't wait for Rust to someday have something even part way as clear at composing systems.

    Eventually I really hope we see programming languages that lean back in to what Erlang started more. This is a leap, but imo having inbuilt great patterns for system design would look a whole lot like Effect! Systems practically assemble themselves. There's great powerful meaningful abstractions under foot.

    The only other meaningful effort I can call out is Clojure, which made a handful of good primitives. That community only really used atoms and defs, less refs (software transactional memory) and agents, is what I've been told.