‹ 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. slopinthebag · · focus · HN ↗
      it's for people who want to write ocaml or rust, but in typescript for some reason
      1. nvme0n1p1 · · focus · HN ↗
        It does seem like they're boiling the ocean, for... whatever reason programmers do these things.

        Rebuild JS&#x27;s core data structures: <a href="https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;v4&#x2F;api&#x2F;effect&#x2F;Array" rel="nofollow">https:&#x2F;&#x2F;effect.website&#x2F;docs&#x2F;v4&#x2F;api&#x2F;effect&#x2F;Array

        Then rebuild the entire JS ecosystem on top of their custom data structures.

        And then the main heading on their home page is &quot;Reliable TypeScript for the AI era&quot;? Really? I&#x27;ll pass.

        1. maleldil · · focus · HN ↗
          It literally says:

          &gt; Works with JavaScript arrays

          1. nvme0n1p1 · · focus · HN ↗
            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&#x27;s built in to the language?

              a = [1, 2, 3];
              foo = [...a, 4];
            1. slopinthebag · · focus · HN ↗
              did you read the docs? it says

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

              ...whatever that means lol

              1. itishappy · · focus · HN ↗
                NonEmpty is a type that allows you to distinguish between:

                    a = [undefined];
                    res = a.pop() &#x2F;&#x2F; undefined
                
                    a = [];
                    res = a.pop() &#x2F;&#x2F; undefined
                1. skeledrew · · focus · HN ↗
                  As a Python person, that 2nd one looks like a bug. Expecting an exception there. Although also Python doesn&#x27;t have an `undefined`; `None` would have to suffice.
                  1. spaethnl · · focus · HN ↗
                    That 2nd one being a bug is exactly what the type system and NonEmpty types is designed to help prevent.
                    1. skeledrew · · focus · HN ↗
                      Not really. If you try to take something from an empty container (language or real life) then you should get an error&#x2F;issue. The container type doesn&#x27;t change when it&#x27;s empty, and the operation is just senseless; all that&#x27;s happening here is added mental gymnastics that makes code unintuitive to read. Checking if&#x2F;asserting a container isn&#x27;t empty is a straight forward `if cont: ...` or `assert cont` in Python, which anyone can just get.
                      1. itishappy · · focus · HN ↗
                        Right, you can attempt to take and potentially error, but if you already know that taking is possible you can skip the noise and simply return a result. Checking if your container is empty every time you remove an item is not free.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.