back to unrelated thing about static typing and HTML template rendering
I think the thing that makes it back into sort of
a tractable problem (especially in static typed land)
is not thinking of it as a string interpolation problem :: String -> String
but as a tree rendering problem :: DOMTree -> String
and decomplects a bunch of BS (edited)
because instead of putting logic in your templates
which seems like an extraordinarily complex thing
first you just need a DOMTree
value
and you can do whatever gymnastics logic :: a -> DOMTree
then the renderer is just :: DOMTree -> String
And like, regular programming languages and data structure literals are Good Enough
at constructing trees, that’s why Hiccup/Sablono can use normal map
etc.
normal data structure functions to construct normal trees
i.e. most of the _content logic_ is at the data-structure tree-structure level (edited)
and then the _string rendering_ is just a mechanical transform of the tree that’s been constructed