1. 27
  1.  

  2. 3

    I’ve used Elm professionally for about a year and a half, maybe longer, and we’ve had more or less the exact same experience. I’ve also recently lived in Norway, and have used Vy (before it’s name change).

    It has made me more curious about more ‘advanced’ functional languages like PureScript, and I wish there was a good comparison of Elm to it (and also other languages such as ReasonML).

    1. 3

      I don’t use Elm very much but I have used a good amount of Purescript (and Typescript), and having simple JS interop is such a game changer. Really wish that it could stick around.Elm works well for a lot of UI stuff but it’s just annoying to have to “do stuff” when I have some existing JS.

      Though kinda ironically I think Purescript is a really good backend language. Effects systems are super valuable on server-side code but don’t actually tend to be that helpful in frontend code (beyond how they’re used for dictionaries).

      1. 2

        Are effect systems not useful for error management for in frontend code?

        1. 1

          Effects systems are super valuable on server-side code but don’t actually tend to be that helpful in frontend code (beyond how they’re used for dictionaries).

          Mind elaborating on this?

          1. 1

            I wrote a thing about this a couple years ago, basically the granular effects system of purescript let you track DB reading and DB writing separately, to let you establish stronger guarantees about what kind of IO is happening in a function

            http://rtpg.co/2016/07/20/supercharged-types.html

            Some other examples over the years that I would find useful:

            • an effect like “DB access of unknown result size”. For example a raw SQL query on a table without any sort of LIMIT could potentially return a lot of data at once, whereas in web requests you want to have consistent, fast replies (so you should opt for pagination instead)

            • an effect like “accesses multi-tenant data”. This will let you determine what parts of your system are scoped down to a single tenant and which parts are scoped to multi-tenant data

            • An effect like “makes IO requests to an external service”. You could use this to qualify your SLAs in certain parts of your system (your own system probably should be built for higher expected uptime than some random third party)

            • An effect like “locks this resource”. You can use this to make sure you unlock the resource at a later data. Normally this is accomplished through a simple bracket pattern but with effects systems you can opt for different styles.

            Because the row polymorphism doesn’t force you to stack monads you avoid the mess of writing up a bunch of transformers and unwrapping/rewrapping items to get at the innards.

          2. 1

            Since we’re a startup we had effectively 0 existing code to worry about, which I guess make it easier in that regard for us.

            Do you use the more ‘complex’ functional concepts like type classes?

            I wonder if anyone would pick Purescript over Haskell for the backend.

          3. 2

            For us, at least, the relative simplicity of Elm was a big part of being able to move existing developers over to it.

            There were definitely times I missed metaprogramming or other fancy features, but I think hiding a lot of ‘magic’ is intimidating (even though they’re coming from a JavaScript background, where cheaty magic is just how things get done).

            Our experience also aligned with this post. We didn’t yet fall into the trap of trying to use elm-git-install for sub-dependencies (maintaining first-level dependencies is time-consuming enough) but it’ll probably happen sooner or later.

            1. 2

              You’re right about the simplicity making it easy for new developers to get started and feel confident with the language.

              I personally feel like I’m now wanting more complex concepts (metaprogramming, type classes, ..).

              We too haven’t reached that point, but I could see that in a year.

              1. 2

                I really did miss type classes. Partially specified types is an ‘ok’ workaround in some cases, but it still felt incomplete. Especially not being able to extend Num.

                1. 1

                  What do you think about nikita-volkov/typeclasses? Useful or not really?

                  1. 2

                    Wasn’t aware of that package at the time (loved the book, BTW) - but it looks like it might clean up some of the ugliness we had around non-primitive comparable. I’ll have to see if that works out when I’m on that project next. Thanks!