Online REPL for teaching

Hi,

several months ago I already asked if somebody knows how to include an online-REPL into a website, because a colleague and I would write an online lesson about FP with Elm. Include online REPL

The first part about FP in Elm is almost finished (german): inf-schule | Deklarative Programmierung » Funktionale Programmierung mit Elm
The second part will be about using Elm to create interactive webpages. I will use https://ellie-app.com for that part.

For the first part it would still be great to have an online-REPL, because at schools, there is often the problem that you cannot install arbitrary software and it is often prohibited to open the terminal. Ideally, it would be a REPL like the one in the official guide, where individual code fragments are provided that can be further explored in the REPL. However, a blank REPL that is just linked as an alternative to the terminal would also be sufficient. Unfortunately, neither of us is particularly skilled in JavaScript, and we are not Elm experts either. As far as I know, the online REPL is connected to a server that executes the Elm code and then sends back the response.

It seems that there was a REPL at http://elmrepl.cuberoot.in
But it is not working anymore.

Is there anyone who can give hints on how to achieve something like this or would be willing to help?

Kind regards, Tom

3 Likes

You might be interested in Discover Functional Programming with Elm. I don’t know if they have the time to help but they’ve done some “run Elm for a website”. Might also be worth asking @terezka how the Elm try page works as that’s similar.

1 Like

Thank you, I didn’t know this tutorial yet, looks good.

I think the code of this is still public, I’ll try to look it up next week after vacation (I think I also cloned it, if it should not exist anymore)

I think it was basically showing a repl running on a server container.
So something like How Codapi differs from other code playgrounds might be a replacement.


The Try Elm! and all other solutions I’ve seen so far always communicate with a server.

I think something running in the browser without a server backend would be optimal for teaching programming concepts.
Maybe you can have a look at elm-interpreter and adapt it?

Execution speed should not be a big issue for smaller snippets and having a repl, and maybe there is even more progress that was not shared yet?
I think @miniBill or @jxxcarlson could be good contacts to ask.

Hi @tomka ,

I did some work on an Elm Notebook project a while back. The main idea is to have notebooks with cells of either markdown text or Elm code. You evaluate the code by ctrl-enter or using the buttons. Evaluation works by talking to the Elm compiler so that you get good error messages.

I hadn’t used this app in a while and going back to it now I find the UI in need of MUCH work! Maybe useful for teaching functional programming, but needs a lot of work.

Anyway, let’s talk! The app is at https://elm-notebook.org/ and the code is at GitHub - jxxcarlson/elm-notebook-v2 .

Hi,

thank you for your great feedback.

@marcw : I found the source at GitHub - girishso/elm-repl-in-browser: Sources for Elm Repl in browser
Unfortunately, I couldn’t get it up and running. However, I have no experience with yarn, etc.

After some trial and error, I was able to get elm-interpreter up and running. It looks very impressive. But from what I can tell, there doesn’t seem to be an obvious way to get Elm compiler error messages.

@jxxcarlson : I have seen elm-notebook.org before, and to me that is also very impressive. It doesn’t directly fit my needs, but technically it should be pretty close. If you are willing to help that would be fantastic!

If there would be a version that is just a simple REPL, that would already be great.

Another version I could imagine is something like a very simple version of Thonny (and similar IDEs for Python) where you put your Elm-Code in the upper area and use it in in the REPL below:

Another approach could be to have an empty notebook, that is publicly available with a minimal GUI.

I think I can make something that more closely fits your needs. I’ll be able to give that a try next week.

That would be amazing, I am excited for news :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.