5 ms·
I 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
by purescript 11y ago
I 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