Paul L wrote:
Pardon me to hijack this thread, but I have an idea to build a
different kind of Web Framework and am not sure if somebody has
already done it.
The idea is to take REST further: every HTML page you see is a program
in its running state (as a continuation monad). Each click on its link
or form submission is seen as feeding data to resume its continuation.
So instead of writing a server-side program that responds to many CGI
calls, you write a single ordinary program that describe the
application logic, which during its execution gets represented as a
HTML page and interpreted by the server.
WASH/CGI has something in that direction. I don't know a short
introduction, but have a look at sections 4 and 8 of the implementation
notes
http://www.informatik.uni-freiburg.de/~thiemann/WASH/draft.pdf
The basic idea is that displayForm in a CGI-script like
main = do
password <- displayForm $ (label "Enter password" <-> editbox)
...
displays a HTML-page to the client, "waits" for a response and then
resumes execution. It does not actually wait, but captures the
continuation in the transmitted HTML page, for instance by saving a log
of the previous events.
This is related to [MonadPrompt], which has a similar purpose, and to
[Unimo], which is pretty much the same but from the slightly different
viewpoint of implementing any monad directly from its operational semantics.
[Unimo]: Chuan-Kai Lin. Programming Monads Operationally with Unimo.
http://web.cecs.pdx.edu/~cklin/papers/unimo-143.pdf
[MonadPrompt]: Ryan Ingram.
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MonadPrompt
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe