[Haskell-cafe] question about interruptable state runner

Mario Blažević mblazevic at stilo.com
Mon Jun 13 18:30:46 CEST 2011


On 11-06-09 04:14 PM, Alexander V Vershilov wrote:
> Hello.
>
> I'm writing a small tcp server with that can handle connections and
> answer by rules writen in a small script that can be interpreted by server.
> For this purpose I've written an interpreter that has type
>
>    ErrorT MyError (StateT ScriptState IO)
>
> so I can call "native" IO function in that script, and define new one.
>    I can run this script with runState (runErrorT (...)) oldState.
>
> But there is one problem: in script i should be able to call functions that
> will stop script interpretation and wait for some server event. To continue
> interpretation.
>
> Can smb give an advice what is the best way to do it?
>

	It appears you've already settled on operational, and that's a good 
choice. I just wanted to point out the monad-coroutine as a possible 
alternative. The two packages have lots of similarities, the main 
difference appears to be in the way the monad suspension is seen: Prompt 
vs. Functor.



More information about the Haskell-Cafe mailing list