futhark icon indicating copy to clipboard operation
futhark copied to clipboard

Add an online futhark "playground"

Open Munksgaard opened this issue 3 years ago • 4 comments

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

Munksgaard avatar Aug 25 '21 07:08 Munksgaard

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.

Munksgaard avatar Aug 25 '21 07:08 Munksgaard

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.

Munksgaard avatar Aug 25 '21 07:08 Munksgaard

However, it would be nice if we could also run literate programs, test datasets and so on.

Munksgaard avatar Aug 25 '21 07:08 Munksgaard

Don't forget http://try.mosml.org/ 😉

(Alas, it does not support playground links and it seems that SSL certificate is outdated.)

kfl avatar Aug 25 '21 07:08 kfl

Perhaps something for @WilliamDue?

Munksgaard avatar Jan 11 '23 07:01 Munksgaard

Perhaps something for @WilliamDue?

Could be fun, would Hakyll be used?

WilliamDue avatar Jan 12 '23 19:01 WilliamDue

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?

athas avatar Jan 31 '23 12:01 athas

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.

Munksgaard avatar Jan 31 '23 14:01 Munksgaard

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.

Munksgaard avatar Jan 31 '23 14:01 Munksgaard

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.

athas avatar Jan 31 '23 14:01 athas

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?

dominicmkennedy avatar Oct 26 '23 17:10 dominicmkennedy

Yes, it is actually here: http://playground.futhark-lang.org/

...except that the server seems to have crashed without anyone noticing.

athas avatar Oct 26 '23 17:10 athas