Online REPL and Mini-IDE

Some time ago, I asked if there was an online REPL for Elm, as this would be very useful for teaching functional programming with Elm. One of my students has now implemented this, and I have put the server online:

elmrepl.de

It is even more than just a REPL, as it mimics a “Mini-IDE”. Of course, it is not meant to be a complete online IDE, but it is very practical for teaching. In the upper window, you can enter Elm code, which you can then execute in the REPL below. It is also very practical that you can save the Elm code as a file or as a link, for example:

https://elmrepl.de/?compressed=H4sIAAAAAAAAEyWMSwrDMBBD93MKMauapDlAwftuegiTCNfgT4gd2uNnINoIPSSVtp2Z%2BIRUwf%2FeeqoRj2VxIqVHeOiPeW2FCAPjSzCXg3vG6%2BlUJB7ksElHDdbxApO%2BExTTdDNzne9sjxd5FHVhcAAAAA%3D%3D&repl=greetings%20"Elm-people"

The REPL-Code in the URL has to be appended by hand, if you want that. But the (compressed) Elm-Code can be generated by button-click (lower-right corner)

If you are interested in the sources: GitHub - tomkarp/elmrepl

Perhaps it is useful to other people too. To me, that is very handy, because students are not allowed to open the terminal window at school. With elmrepl.de and ellie-app.com I don’t need a local installation for teaching and students can even work with an iPad if they want/have to.

Feel free to give feedback what could/should be improved…

24 Likes

A nice tool for students and teachers as well as for many beginning programmers (like me :slightly_smiling_face:). It’s very intuitive, no need to read more user instructions. I used it just for debugging my little stuff, please look at this.
Go to REPL and try the following instructions:

> import Main exposing (..)
> factor2
(84894624407,"[") : ( Int, String )
> otherFactors
(6353,"[3067, 4357, 6353]") : ( Int, String )
> List.product [3067, 4357, 6353]
84894624407 : number
>

> factor2
(3,"[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ")
    : ( Int, String )
> otherFactors
(3,"[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3]")
    : ( Int, String )

Similar IDE is DrRacket for racket programming combining definition-window and REPL .

1 Like

Racket was one of the candidates to teach FP. I still think it is nice, but I like Elm much more. Generally and for teaching …

Very nice! Did your student wrote the code editor with line numbering and syntax highlighting in Elm? Or is it outside the Elm app using some JS library?

They are teaching FP in the German schools with Elm and Python.
The teaching material is free on the web-site but solutions to the exercises can be seen only as a registered user and one can send his/her own comments or solutions if teacher. Here is an example of the published material by inf-schule “The Electronic School book”.

2 Likes

No, he didn’t use Elm. He used several JS libraries for the editor, terminal, web sockets and so on. On the server there are docker containers running for each user. Each time a user changes the Elm-code or types in the REPL, the changes are submitted to the docker container. If you want you can see the code on GitHub (link above)

“They are teaching FP in the German schools with Elm” gives a wrong idea. In Germany each state defines what has to be teached. In Rheinland-Pfalz - wich is one of germanys states- teachers can choose to teach FP or Prolog at advanced courses. If a teacher decides to teach FP, he can choose any language. Some of the teachers use Haskell, Python, … The Elm-FP chapter at inf-schule.de is written by me and one of my colleagues. Overall, FP and Elm is teached only rarely, but I guess FP will gain a little bit of focus over the next few years. Since inf-schule.de is well known in Germany, I guess some of the teachers will choose Elm over Haskell in the future.

1 Like

Excited waiting, what will be written about recursion and randomness (random number generators) by TK and KB to inf-schule.de hopefully already in the autumn.

The chapter about recursion is (almost) finished and online. It includes a nice simulation of towers of hanoi, an example about tail recursion and other things.

The part that covers dynamic web pages will still take a while…

3 Likes