I am working on a small Purescript application that produces visualizations. My architecture is a bit non-traditional, however, and I'm having some issues. Here's what I want:
- Launch
pulp psci -- --port 8080
and connect with a browser - Call a function
go
which accepts a definition of the visualization and renders it along with some controls - See the results. Go back to the REPL and possibly create some new definitions.
- Go to step 2 and draw the new visualization with
go
.
This sort of works with what I have so far, but my problem is that repeated calls to go
do not replace the contents of the DOM, but instead are added to them. This means that after a few calls I end up having many copies of all the controls and everything.
I realize this is a bit of a hack, but the only other way I can think to provide this kind of interactive interface is to implement an editor/parser and that's too much work Is there a way to avoid this?
Here's my definition of go
, which I imagine needs changing:
go :: Vis -> Eff (HA.HalogenEffects ()) Unit
go vis = HA.runHalogenAff do
body <- HA.awaitBody
runUI checks vis body