play-haskell icon indicating copy to clipboard operation
play-haskell copied to clipboard

Allow user input

Open ulysses4ever opened this issue 1 year ago • 2 comments

Hey! This surely has come up before somewhere: how hard would it be to add the ability to read user's input? I guess the most annoying part is how to structure the UI?

There's a post on Discourse from someone learning Haskell and trying to get a LYAH example with input working... https://discourse.haskell.org/t/9859

ulysses4ever avatar Jul 10 '24 16:07 ulysses4ever

The primary issue is that the current execution model is completely batch-based: the program is sent to the server, which assigns a worker to compile and run it; the worker then sends back the output, which gets routed back to your browser. If the user input functionality is supposed to be interactive (just an additional field for an input blob which is sent to stdin as-is is not very useful, I think), this overturns this whole model. And if we are to support such an interactive session anyway, it would be even better if we could also have an interactive ghci session on the playground.

But all that takes a surprising amount of engineering, and raises questions around time allocation and spam control. That's why none of this has been implemented yet.

Unless you think an extra <textarea> for input to be made available on stdin is more useful than I thought?

tomsmeding avatar Jul 10 '24 16:07 tomsmeding

just an additional field for an input blob which is sent to stdin as-is is not very useful

Agreed.

If the user input functionality is supposed to be interactive... this overturns this whole model.

Oh my, I keep forgetting about this model although I learned it at some point. Yeah, this sounds like a big undertaking.

I won't hold my breath then. But this ticket may be useful for future reference. Thanks!

ulysses4ever avatar Jul 11 '24 00:07 ulysses4ever