to support frontend plugin in interactive mode, for interactive code exec w/ Web UI
Currently frontend plugin is a mode mutually exclusive with interactive mode, although the
GHCi monad could host a frontend plugin well by lifting its
What I'm prototyping is a simple web page allowing Haskell source editing and execution, while the code will be executed in a custom monad allows interactive msg logging and plotting to the web page (with BokehJS).
The web page is currently a single-box Haskell source editor (CodeMirror based) with a [Crunch!] button and a log box shown to the user. Under the hood, each time this web page is opened by a browser, a Websocket connection is established with the web server, the web server just spawn a subprocess with fd of the websocket socket inherited, this subprocess then serves the ws with websockets for dynamic Haskell code execution. Each time the user input a valid statement and clicked the [Crunch!] button, the source is passed through the websocket connection, to the said backend subprocess for hosted execution, where the code can log to web UI and producing plot figures during the run, via a custom monad api communicating those data through the websocket connection.
I intend to implement this subprocess as an GHC frontend plugin, instead of a GHC API (or hint) based interpreter, especially to after the great convenience what
stack ghci can provide when run under a stack project dir, where artifacts available to interactive Haskell code, as well as GHC(i) runtime options are very flexible for the author, he/she can just tune the
package.yaml and tree of module files to fulfill virtually any intent. My web server can just be started from a stack project directory to get all of it.
stack ghc --ghc-options "--frontend XX" won't pass as much useful info about the stack project as
stack ghci does, thus not really convenient. So here's this proposal.
I propose to add a
:frontend command to GHCi, intended to be used like:
stack ghci --ghci-options '-fobject-code -e ":frontend XX" -ffrontend-opt <WSFD>'
Where the frontend plugin is hosted by the beast of GHCi monad initialized with all good stack project stuff.