[Haskell-cafe] question about interruptable state runner

Alexander V Vershilov alexander.vershilov at gmail.com
Fri Jun 10 22:24:08 CEST 2011

Fri, Jun 10, 2011 at 03:27:44PM +0200, Heinrich Apfelmus wrote
> Alexander V Vershilov wrote:
> > 
> > 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?
> Basically, you want to stop the interpreter and resume it at some later 
> point. You need to implement a custom monad for that, which can easily 
> be done with the help of my  operational  package.
>     http://projects.haskell.org/operational/
> In particular, the examples
>     WebSessionState.lhs
>     TicTacToe.hs
>     PoorMansConcurrency.hs
> show how to suspend and resume the control flow. Feel free to request 
> additional examples.
> Best regards,
> Heinrich Apfelmus

Operational package is the what I need, thanks. Documentation is and examples
are very good so I think I'll have no problems to implement such a behavior.

Best regards
  Alexander V Vershilov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110610/0637a86e/attachment-0001.pgp>

More information about the Haskell-Cafe mailing list