elm-lang / elm-reactor

Interactive development tool that makes it easy to develop and debug Elm programs.
BSD 3-Clause "New" or "Revised" License
428 stars 63 forks source link

elm-reactor repl features #166

Closed rundis closed 8 years ago

rundis commented 8 years ago

Perhaps a tall order, but I imagine it would be fantastic from a tooling perspective to be able to have a repl session through elm-reactor.

To give some context:

I might be dreaming, but it would be awesome if; I could connect to a repl through reactor (maybe through websocket ?) from my editor and

  1. Evaluate an expression (say a function call), providing the a module name for context and get a result back (maybe as json). Without the need to save a file that is compiled, (if a file is created in the background to make it happen is an impl detail, as long as it doesn't make into any of my projects .elm or .js files)
  2. Evaluate an function definition again providing module name for context, if the function is already defined in the module, the function definition is replaced, if it's new it's added. Hot-swapped while the program is running

There are surely lots of other cases where a repl through elm-reactor would be very neat too ?

  1. Is mostly supported by elm-repl today, but It would be useful to say interactively test view stuff as well
  2. I imagine this wouldn't be trivial, but would be quite useful for an exploratory way of trying out new implementations. It might also be a nice way to add Debug.log / Debug.watch without polluting your "production code". Hey from a editor users perspective I might even be able to just let the user mark an expression and select a shortcut for adding a watch and then the editor can transparantly add a watch (and at some point in the future, when there is a cli for accessing watches, show the values of a watch inline in the editor :-)

Of course it would be fantastic if all evals that fails compiler checks get a error result (again json format might make sense) so that the editor can display sensible feedback to the user.

hope some of what I'm trying to say makes some sense ! cheers Magnus

evancz commented 8 years ago

Have it listed at https://github.com/elm-lang/projects#in-browser-repl

I also think it'd be cool. In time!