command-line interaction with running process

Hi, I'm trying to do the following: implementing a command-line interface to directly interact with the state or the parameters of a looping/running process (a game, to be specific). My first thought is to fork a thread, passing in a TChan/TVar or similar to enable communication, and to have the command-line interface on the thread (getLine or haskelline ...). Another option would be to have a bona fide server-client interface (with sockets or others), to fork a thread again to run the server and to connect using the client library - which would allow me to use ghci and have transparent serialization under the hood. Are there known use cases? Am I missing something, for instance is it possible to interact with a running process directly using ghci? Any tips? Thank you, Elise

If you decice upon the server-client architecture, you should take a look
at zeromq.
It is used extensively in IHaskell, so you can peek at the code there for a
working example.
Also, I believe a client-server architecture will be better as I personally
enjoy games a lot more when they are multi-player.
It makes the conversion from single-player to multi-player a
non-destructive (or atleast less destructive) process.
On 4 March 2015 at 15:02, Elise Huard
Hi,
I'm trying to do the following: implementing a command-line interface to directly interact with the state or the parameters of a looping/running process (a game, to be specific).
My first thought is to fork a thread, passing in a TChan/TVar or similar to enable communication, and to have the command-line interface on the thread (getLine or haskelline ...). Another option would be to have a bona fide server-client interface (with sockets or others), to fork a thread again to run the server and to connect using the client library - which would allow me to use ghci and have transparent serialization under the hood.
Are there known use cases? Am I missing something, for instance is it possible to interact with a running process directly using ghci? Any tips?
Thank you,
Elise _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards Sumit Sahrawat

Thanks for this answer - that's a good point.
At this point it's mostly for (interactive) game/level design and
testing though :)
On 4 March 2015 at 10:45, Sumit Sahrawat, Maths & Computing, IIT (BHU)
If you decice upon the server-client architecture, you should take a look at zeromq. It is used extensively in IHaskell, so you can peek at the code there for a working example.
Also, I believe a client-server architecture will be better as I personally enjoy games a lot more when they are multi-player. It makes the conversion from single-player to multi-player a non-destructive (or atleast less destructive) process.
On 4 March 2015 at 15:02, Elise Huard
wrote: Hi,
I'm trying to do the following: implementing a command-line interface to directly interact with the state or the parameters of a looping/running process (a game, to be specific).
My first thought is to fork a thread, passing in a TChan/TVar or similar to enable communication, and to have the command-line interface on the thread (getLine or haskelline ...). Another option would be to have a bona fide server-client interface (with sockets or others), to fork a thread again to run the server and to connect using the client library - which would allow me to use ghci and have transparent serialization under the hood.
Are there known use cases? Am I missing something, for instance is it possible to interact with a running process directly using ghci? Any tips?
Thank you,
Elise _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- Regards
Sumit Sahrawat
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

I did something similar a while back using a socket based "terminal
session" into an OpenGL program so I could change things as it ran.
It's viable. I used TVar I think and didn't encounter any issues.
Sadly, the code has vanished but it worked well and wasn't that much code
actually thanks to the libraries being good.
On 4 March 2015 at 09:32, Elise Huard
Hi,
I'm trying to do the following: implementing a command-line interface to directly interact with the state or the parameters of a looping/running process (a game, to be specific).
My first thought is to fork a thread, passing in a TChan/TVar or similar to enable communication, and to have the command-line interface on the thread (getLine or haskelline ...). Another option would be to have a bona fide server-client interface (with sockets or others), to fork a thread again to run the server and to connect using the client library - which would allow me to use ghci and have transparent serialization under the hood.
Are there known use cases? Am I missing something, for instance is it possible to interact with a running process directly using ghci? Any tips?
Thank you,
Elise _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (3)
-
Elise Huard
-
emacstheviking
-
Sumit Sahrawat, Maths & Computing, IIT (BHU)