And would it benefit from having one?
The problem is, that
Node is opaque:
So when you get some user-defined view customization, lets say its some UI framework you are writing, and you wanted the user to supply their own
Markdown -> Html function
addMarkdown : (Markdown -> Html Never) -> View -> View addMarkdown userCustomization view =
You may want to parse that user defined Html for some reason.
Perhaps not the best example. In my case, I am interested in offering the ability to render custom views for my text editor work. I need to be able to understand the structure of the user customized view, in order to do coordinate mapping for the cursor - to understand how the cursor moves through that section of the DOM.
A reflectice HTML package would define a non-opaque node type, and a function to turn it into an
type ReflectiveNode = Element String (List Attribute) (List Element) toNode : ReflectiveNode -> Node
The idea would be to create a full DSL as an exact parallel to the
elm/html API, just in a different module name-space.
Disadvantage is, there is obviously an overhead when rendering HTML, and it its a novel HTML representation with no connection to existing packages like
Does such a package already exist? Are there other use cases that it could be useful for?