Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OverloadedLists instead of do notation to concatenate Html #33

Open
meiersi-da opened this issue Nov 14, 2015 · 1 comment
Open

Comments

@meiersi-da
Copy link
Collaborator

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 lucids approach to a HTML EDSL in Haskell; i.e., just use a WriterT Html and overload the different application forms using the Term typeclass.

@pkamenarsky
Copy link

I've been wondering about this. Why not just have something like:

div :: [Html a] -> Html a

...similar to purescript-react?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants