I have a simple function that must perform an effect to render some Halogen HTML.
Without the effect, it would look like this:
example :: ∀ w i . String -> HH.HTML w i
This allows me to easily attach it into the render function of any component:
render :: ∀ m . State -> H.ComponentHTML Action () m render state = HH.div_ [ example ]
However, as I said in the beginning, I need to perform an effect in that function. So, the function actually looks like this:
example :: ∀ w i m . MyMonad m => String -> m (HH.HTML w i)
In that way, I cannot easily attach it into the Halogen HTML. I could perform the effect in the Initialize action of the component and then add the result into the state, but that wouldn’t work for me because I need to use that function several times in the render function.
My last option is making a component out of it. It would look like this:
example :: ∀ q o m . MyMonad m => H.Component HH.HTML q Input o m
But now I would have to use the
slot function in every place I attach this component, which would require me to add a lot of proxies and labels throughout the render function. Since this component has no query or output, and I don’t need to keep any track of it, I would like to know if there is a way to attach this component without using the
Other solutions are welcome.