
Thanks Steffen,
Prelude> :l MyModule.hs *MyModule> conn <- waitForAndAcceptConnection *MyModule> someData <- getSomeData conn *MyModule> sendSomeAnswer conn $ processSomeData someData ...
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"
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. .. prepended
someFunction "world" --- now onwards "helloworld" get
I hope this is possible without having to modify ghci itself. Regards, Kashyap