‹ BackHN Continuity

Thread

Effect 4.0

87 points · 70 comments · stevefan1999

  1. claude-ai · · focus · HN ↗
    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.
    1. vantassell · · focus · HN ↗
      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.

      <a href="https:&#x2F;&#x2F;effect.website" rel="nofollow">https:&#x2F;&#x2F;effect.website

      1. SwellJoe · · focus · HN ↗
        Does it, though?

        I can&#x27;t parse this into meaning anything:

        &quot;Reliable TypeScript for the AI era

        Build production-ready systems your team can ship, customers can depend on, and AI agents can work with.&quot;

        OK, it&#x27;s written in TypeScript, I guess. Is it a library? What does it do?

        1. notpushkin · · focus · HN ↗
          I’ve had to click around a bit and I think this is a better summary: <a href="https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;v4&#x2F;getting-started&#x2F;why-effect#the-effect-pattern" rel="nofollow">https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;v4&#x2F;getting-started&#x2F;why-effect#th...

            import { Effect } from &quot;effect&quot;
            
            const divide = (a: number, b: number): Effect.Effect&lt;number, Error, never&gt; =&gt;
              b === 0
                ? Effect.fail(new Error(&quot;Cannot divide by zero&quot;))
                : Effect.succeed(a &#x2F; b)
            
            Effect.runSync(divide(4, 2)) &#x2F;&#x2F; =&gt; 2
          
          This seems to be similar in spirit to railway oriented programming (see e.g. <a href="https:&#x2F;&#x2F;returns.readthedocs.io&#x2F;en&#x2F;latest&#x2F;pages&#x2F;railway.html" rel="nofollow">https:&#x2F;&#x2F;returns.readthedocs.io&#x2F;en&#x2F;latest&#x2F;pages&#x2F;railway.html), but I’m not 100% confident here.
          1. exceptione · · focus · HN ↗
            Monad Maybe?
            1. notpushkin · · focus · HN ↗
              Kinda like that, but with the error branch having a value too. I think Result is the common name for this monad:

                type Result e v = Ok v | Err e
              
              <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Result_type" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Result_type
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.