Closed nullobject closed 8 years ago
You would need to write img ! href "foo.jpg" ## []
.
It's just much simpler and straightforward to use array notation instead of the overloaded do
, and I'm planning on rewriting the examples and docs to encourage that.
For !
to work without children, Html
would have to be monadic. There would also need to be separate constructors, one that takes arrays and one that takes a single argument for use with do
notation. One way to do this is to provide two modules that export element constructors, one for array notation and the other do
notation. My only hangup is what the modules would be called. Maybe Pux.Html.Elements
for vanilla array constructors and Pux.Html.Elements.Simple
or Pux.Html.Elements.Do
for the monadic versions. Both constructors would result in the same type, so there would be no issue mixing and matching views that were written in either style. The downside is that would be a breaking change.
Plus 1 for array notation - I found it ugly when I first saw it in Elm, but you get used to it pretty quickly. It is simple and consistent and also easy to write and understand.
Examples and docs have been updated to use array notation. I'm closing this for now (just reopen if you have something else to say). If there are solid proposals for how to provide a monadic DSL that is built ontop of the array-notation DSL, then the discussion should be continued there.
Cool, thanks for the feedback 👍
I love the shorthand syntax for specifying HTML elements. However, some elements don't have children, for example:
img ! href "foo.jpg"
Unfortunately this doesn't work 😭