purescript-flame
purescript-flame copied to clipboard
Monoid instance for Html a
Is it possible to give Html a
a Monoid instance like React.Basic is doing for JSX
?
Hello @iclanzan , I am afraid I don't know what React.Basic uses monoids for. Is it a list like instance?
https://pursuit.purescript.org/packages/purescript-react-basic/16.0.0/docs/React.Basic#t:JSX
JSX
is aMonoid
:
append
Merge twoJSX
nodes usingReact.Fragment
.mempty
The empty node; renders nothing.Hint: Many useful utility functions already exist for Monoids. For example,
guard
can be used to conditionally render a subtree of components.
I suppose this could be done. Though flame doesn't really have an equivalent to empty
right now.
I wonder if mempty = fragment []
would work.
document.createFragment
is currently used for fragments. I think it could work if treated as a special case.