add renderSumType to efficiently render sum types#115
add renderSumType to efficiently render sum types#115anderspapitto wants to merge 1 commit intoreflex-frp:developfrom
Conversation
See inline comment on renderSumType. This function provides an alternative to two approaches to sum types that already exist - using dyn/widgetHold. This approach has the downside that the Dynamic is lost while rendering everything under the sum type, which means that every change causes a full re-render. - rendering every constructor, and having a dynamic attribute with 'display:none' set for everything except the currently active constructor. This works but is less principled - you are rendering something that doesn't actually exist, and then hiding it, instead of simply not rendering it in the first place (the approach of renderSumType).
|
Can this be merged? |
|
This has overlaps with reflex-frp/reflex#106.
|
|
My memory is a little fuzzy by now, but here are a few points
It is complete and it does what I wanted it to do. From that perspective it can be merged (or someone, e.g. @adamConnerSax can cannibalize bits of it into other PRs).
From a brief look at your PR, it looks like my tldr; I'm equally fine with this being merged, with it being closed as no-intention-to-merge, or with someone else taking over to see it through. |
|
The tags are isomorphic, I just needed a good nights sleep to see why. You cleverly re-used NS as the choice element of the tag type (more or less), whereas I created a new type to represent a choice of elements of a type level list. Adam |
I believe this is complete enough that we can figure out if/where it has a home upstream in reflex-dom.
See inline comment on renderSumType.
This function provides an alternative to two approaches to sum types
that already exist
using dyn/widgetHold. This approach has the downside that the Dynamic
is lost while rendering everything under the sum type, which means
that every change causes a full re-render.
rendering every constructor, and having a dynamic attribute with
'display:none' set for everything except the currently active
constructor. This works but is less principled - you are rendering
something that doesn't actually exist, and then hiding it, instead of
simply not rendering it in the first place (the approach of
renderSumType).