Use `OverloadedLists` instead of `do` notation to concatenate `Html`
meiersi-da opened this issue · comments
I removed the Monad
instance for the variant of Html
which is serializable with embedded event-handler annotations. This currently means that one has to write things like
H.div $ mconcat
[ H.p $ mconcat ["one", "two", "three"]
, H.p "another paragraph"
, H.p "perhaps a footer"
]
to concatenate Html
. I think it would be worth a try to use OverloadedLists
to simplify it to
H.div
[ H.p ["one", "two", "three"]
, H.p "another paragraph"
, H.p "perhaps a footer"
]
one possible problem is that this would not play very well with Lucid's Term
overloading trick. Moreover, we might be better off anyways by using lucid
s approach to a HTML EDSL in Haskell; i.e., just use a WriterT Html
and overload the different application forms using the Term
typeclass.
I've been wondering about this. Why not just have something like:
div :: [Html a] -> Html a
...similar to purescript-react
?