News for hackers. Stuff that matters.
Re:Elm by Example by masklinn on Sunday December 13, 2015 @11:13AM (#10726687)
With respect to (2), I've found non-trivial forms to be an especially annoying example. There seems to be lot of fairly trivial repetition in elm architecture code which I can't really manage to extract.
Re:Elm by Example by purescript on Sunday December 13, 2015 @11:15AM (#10726695)
I've found lenses (for zooming state) and prisms (for zooming actions) to be very useful for solving this problem.
Re:Elm by Example by vagif on Sunday December 13, 2015 @01:08PM (#10727152)
Can you comment on your latest approach in purescript-thermite to use lenses (focus, foreach) vs halogen architecture? Pros / Cons?
Re:Elm by Example by purescript on Sunday December 13, 2015 @01:40PM (#10727293)
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/ [2]: https://github.com/zrho/purescript-optic-ui [3]: https://github.com/joneshf/purescript-totally

Re:Elm by Example by tel on Sunday December 13, 2015 @11:56AM (#10726872)
Does Elm have a lens library?
Re:Elm by Example by purescript on Sunday December 13, 2015 @12:30PM (#10727002)
I 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/Focu...