Connecting to a running process (REPL)

Is there a good standard way of supplying a read-eval prompt in a program? I would like to a running process with something ghci-like to be able to inspect the state and possibly modify it. The running process would be heavily multi-threaded. Thanks, Joel -- http://wagerlabs.com/

Hello Joel, Tuesday, December 06, 2005, 1:35:50 PM, you wrote: JR> Is there a good standard way of supplying a read-eval prompt in a JR> program? just fork a thread to do it :) -- Best regards, Bulat mailto:bulatz@HotPOP.com

On Tue, Dec 06, 2005 at 10:35:50AM +0000, Joel Reymont wrote:
Is there a good standard way of supplying a read-eval prompt in a program?
I would like to a running process with something ghci-like to be able to inspect the state and possibly modify it. The running process would be heavily multi-threaded.
Some time ago I was thinking about implementing a Haskell telnet server module, but now I think that this would be a difficult solution for a simple problem. You can almost use GHCi for what you want. You could simply run your program under from within GHCi. Of course you would have to structure your program in such a way that you could reach the interesting parts somehow. I think it could look like this: $ ghci ... Prelude> :l Prog Prog> root <- runProg ... Prog> threads <- getClientThreads root ... Unfortunately it seems that forkIO'ed threads are freezed when GHCi is waiting for command-line input. I bet it would be possible to let the threads work in the background. I think the current behaviour is caused by using readline, which is a foreign library. Or it is by design? Best regards Tomasz -- I am searching for a programmer who is good at least in some of [Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland

Hello Tomasz, Tuesday, December 06, 2005, 11:01:45 PM, you wrote:
Is there a good standard way of supplying a read-eval prompt in a program?
TZ> Some time ago I was thinking about implementing a Haskell telnet TZ> server module, but now I think that this would be a difficult TZ> solution for a simple problem. is that any better than just having one of threads running this read-eval loop? :) possibly on specially allocated console, if the program itself make some screen i/o -- Best regards, Bulat mailto:bulatz@HotPOP.com

On Tue, Dec 06, 2005 at 10:35:50AM +0000, Joel Reymont wrote:
Is there a good standard way of supplying a read-eval prompt in a program?
You might want to look at this module which is a program independent read-eval prompt that I use for jhci. it is completely independent of the rest of the compiler (like everything in the Util.* hierarchy) and depends only on ghc provided libraries. http://repetae.net/john/repos/jhc/Util/Interact.hs for an example of its use see http://repetae.net/john/repos/jhc/Interactive.hs John -- John Meacham - ⑆repetae.net⑆john⑈
participants (4)
-
Bulat Ziganshin
-
Joel Reymont
-
John Meacham
-
Tomasz Zielonka