futhark
futhark copied to clipboard
Add an online futhark "playground"
Many languages have the ability to run in the browser, giving users a kind of "playground" for running small samples of code. It would be nice if we had something similar.
Examples:
- https://play.flix.dev/
- https://play.rust-lang.org/
- https://play.golang.org/
- https://elm-lang.org/try
Extra points for being usable for reporting ICEs.
Eg. if I found a compiler bug, I would like to be able to save the code producing the bug as a playground link and post it here, with the correct error message being produced by the playground.
Simplest possible design: A frontend that sends code stumps to a backend. The backend runs the code using the latest nightly and returns the result.
However, it would be nice if we could also run literate programs, test datasets and so on.
Don't forget http://try.mosml.org/ 😉
(Alas, it does not support playground links and it seems that SSL certificate is outdated.)
Perhaps something for @WilliamDue?
Perhaps something for @WilliamDue?
Could be fun, would Hakyll be used?
Our new student programmer will be working on this. The first design question is quite basic: where should the code run? In the browser, or talk to some backend server? I strongly suspect the latter is most feasible (although it has its own problems). For a start, look at existing such playgrounds/REPLs and figure out how they are designed. Where do they run the code?
Here is some information about the limitations imposed on the Rust playground. I'm not sure how that is enforced, but presumably one could glean that information from the repo somewhere.
As compromise, would it make sense to compile the program on our machines, but run it in the browser, using e.g. our wasm backend? Would that even work?
Edit: In other words, we'd have some backend service which compiles the given program and returns wasm in some format that can be picked up by the browser and executed.
That sounds like the worst of all worlds. I'd rather just have us sandbox the execution in a sensible way. Futhark is a pure language so surely it can't be very difficult.
Is there anyone currently working on this issue? If not I may begin prototyping some solutions for it. Additionally is the plan for the playground to exist on the futhark-lang site or at a different location? Also are there any particular technologies/languages that are preferred for doing the plumbing between the compiler running on a server, and the UI in the frontend?
Yes, it is actually here: http://playground.futhark-lang.org/
...except that the server seems to have crashed without anyone noticing.