1. 8
  1.  

  2. 2

    I think this might be interesting, but I feel like I don’t know enough Haskell jargon to make sense of it.

    1. 3

      Here’s the referenced PureScript implementation of the idea:

      https://github.com/zrho/purescript-optic-ui

      The idea is that your state is a big data structure. You use lenses to focus in and display certain parts, then use those lenses to update parts when events are triggered.

      1. 2

        The lens connection is definitely elegant. I particularly like the (obvious once you see it) property of (profunctor) lenses that they give you free composition operators for anything which looks like p a b for some strong profunctor p.

        The Traversal part was what really impressed me, however. OpticUI has captured the (type-safe!) essence of something like KnockoutJS in a few dozen lines.

      2. 1

        I saw this comment and figured I could read the article and present a summary here. Turns out, I don’t know enough Haskell (specifically Lens) jargon either. My best guess is that this is an experimental alternative to React that handles state like Om. That means it has one top-level mutable state value, but individual components are only aware of their “local” state.

        1. 2

          Yeah, I agree. Are the lenses they’re talking about the same ones that come with barbed wire, or are those lenses unrelated lenses?

          1. 1

            I have never heard of barbed wire with respect to lenses. Is that a reference to Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire? I have not read that. The lenses in this post are van Laarhoven lenses, specifically the lens package.

            1. 5

              The “Bananas, Lenses” paper is a naming collision; its lenses are called that because of the syntax the authors chose, and they’re unrelated to van Laarhoven lenses.

              1. 1

                Thank you!