5 ms·
I've found lenses (for zooming state) and prisms (for zooming actions) to be very useful for solving this problem.
by purescript 11y ago
I've found lenses (for zooming state) and prisms (for zooming actions) to be very useful for solving this problem.
- tel 11y agoDoes Elm have a lens library?
- purescript 11y agoI know there is the Focus library [1]. I'm not sure about prisms, traversals etc. [1] http://package.elm-lang.org/packages/evancz/focus/1.0.1/Focus http://package.elm-lang.org/packages/evancz/focus/1.0.1/Focu...
- deleted 11y ago[deleted]
- vagif 11y agoCan you comment on your latest approach in purescript-thermite to use lenses (focus, foreach) vs halogen architecture? Pros / Cons?
- purescript 11y agoI haven't used latest Halogen yet, so I can't give a detailed comparison, but the approach in Thermite [1] is indeed what I am referring to above. It was based on some work in the OpticUI library [2], and has worked out quite nicely for the few projects I have applied it to. I will say that the types in Halogen seem more complex, but they can be justified by the fact that the coproduct machinery helps ensure all actions get handled somewhere. This may be possible with prisms, I'm not sure yet. This library [3] seems relevant. One issue I've found, which I understand the Halogen folks are also finding, is that it is tricky to wire up action handlers such that a subcomponent can invoke an action and have a parent act on it and invoke its own action in response. Granted, this is a relatively infrequent use case, and you can always push such logic into some shared parent. [1]: https://github.com/paf31/purescript-thermite/ https://github.com/paf31/purescript-thermite/ [2]: https://github.com/zrho/purescript-optic-ui https://github.com/zrho/purescript-optic-ui [3]: https://github.com/joneshf/purescript-totally https://github.com/joneshf/purescript-totally