Idea: REPL Driven Development

Today I was trying to solve a bug, and I realised that it would be much easier to solve if we imported a concept from Clojure, called REPL Driven Development.

I was thinking about the possibility of the elm debugger to have an REPL inside it, with full access to a variable model that contains the current selected state in the debugger, plus access to every module in the project. I think developing and debugging this way would be much easier.

Would it be possible, since elm has static typing?
What do you think about it?

2 Likes

in-browser repl is mentioned here https://github.com/elm/projects

1 Like

Thanks DullBananas! I remember about this project, but I thought it was a simple web REPL. Re-reading now it is clear that Evan was saying about the same thing as me! I’d love to work on this, but I am not sure wether those projects are still desirable. I’ll try anyway.

A Clojure-style REPL would be awesome!

Keep in mind that Elm’s static type system can make things a bit trickier for sending functions on the fly through a REPL. In particular if you rebind names like you do all the time in Clojure (e.g. rebind x = 5 to x = 6), you’ll want to double-check that the types still line up. One particular strategy might be to disallow rebinding of names, except for rebinding the global update and view names (updating the model is a bit trickier, but that’s true in Clojure as well, changing the structure of things in atoms in the wrong way is the number 1 thing that forces me to restart a REPL session), and only allow new names to show up.

1 Like

Also, if you haven’t used it before, something like elm-live (https://github.com/wking-io/elm-live) gets you a lot of the way there. You at least get on-the-fly reloading without needing to restart your app.