[Haskell-cafe] Extending GHCi

C K Kashyap ckkashyap at gmail.com
Fri Feb 4 15:41:24 CET 2011

Thanks Steffen,

> Prelude> :l MyModule.hs
> *MyModule> conn <- waitForAndAcceptConnection
> *MyModule> someData <- getSomeData conn
> *MyModule> sendSomeAnswer conn $ processSomeData someData
> ...
So this cycle of getting data from the connection and writing answer on the
connection should happen concurrently with the ghci interaction ... so lets
say that when the "thread" is forked that listens on socket behaves like an
echo server ... as in, it reads data from the client till "\n" and echoes it
back ... All this would happen without the intervention of the user using
GHCI ... However, using GHCI, the user should be able to modify the code
such that the server returns "hello" prepended to the input. ..

> startMyServer -- at this point the the echo server gets spawned
>                       -- echo server continues to run
> someFunction "hello" --- now onwards  hello gets prepended
>                       --- echo server continues to run returning "hello"
> someFunction "world" --- now onwards "helloworld" get

I hope this is possible without having to modify ghci itself.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110204/217eabc9/attachment.htm>

More information about the Haskell-Cafe mailing list