Continuation-based programming on top of Happstack

14 views
Skip to first unread message

Chris Eidhof

unread,
Dec 19, 2009, 10:47:33 AM12/19/09
to HA...@googlegroups.com
Hey Happstackers,

I've written a little sample program that shows how you can do
continuation-based web programming in Haskell. It currently runs on
top of Happstack (it could easily be adapted to other platforms). I am
quite interested in your thoughts on this. I've put a self-contained
example online at http://gist.github.com/260052

Although there are some limitations to this approach, this is how I
would like to write my websites in Haskell. I'm currently
investigating other approaches as well (e.g. an arrow-based approach),
but just I thought I'd share it.

-chris

Colin Adams

unread,
Dec 20, 2009, 12:02:48 PM12/20/09
to ha...@googlegroups.com
2009/12/19 Chris Eidhof <ch...@eidhof.nl>:

> Hey Happstackers,
>
> I've written a little sample program that shows how you can do
> continuation-based web programming in Haskell. It currently runs on
> top of Happstack (it could easily be adapted to other platforms). I am
> quite interested in your thoughts on this.

I find it not easy to read because of the choice of names.
E.g. You call a web continuation a Web. Why not Continuation or
WebContinuation? Similarly runWeb. Does this mean runWebContinuation?
And runPage for a function that ignores the request. No doubt there's
logic in that, but if it were called ignoreRequest, I might find it
easier to read the example.

Anyway, it looks very interesting. I might try converting my current
effort for an image gallery to that style, and see if it reads easier.
--
Colin Adams
Preston,
Lancashire,
ENGLAND

John MacFarlane

unread,
Dec 20, 2009, 12:56:17 PM12/20/09
to ha...@googlegroups.com
+++ Chris Eidhof [Dec 19 09 16:47 ]:

> Hey Happstackers,
>
> I've written a little sample program that shows how you can do
> continuation-based web programming in Haskell. It currently runs on
> top of Happstack (it could easily be adapted to other platforms). I am
> quite interested in your thoughts on this. I've put a self-contained
> example online at http://gist.github.com/260052

That's really neat. How about a link to this on the happstack.com
tutorials page?

John

Jeremy Shaw

unread,
Dec 20, 2009, 2:34:26 PM12/20/09
to ha...@googlegroups.com
I have not had time to understand how this works yet. But now that 0.4
is out, I hopefully can!

How is it similar to or different from WASH/CGI ?

- jeremy

> --
>
> You received this message because you are subscribed to the Google
> Groups "HAppS" group.
> To post to this group, send email to ha...@googlegroups.com.
> To unsubscribe from this group, send email to happs+un...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/happs?hl=en
> .
>
>

Chris Eidhof

unread,
Dec 21, 2009, 4:09:46 AM12/21/09
to ha...@googlegroups.com
Well, this is different in a couple of ways. First of all, it is
unfinished. The basic idea works, but it's impossible to serialize
continuations, which is a serious problem, as I'm pretty sure it can't
be fixed. So this doesn't scale to multiple servers or run on CGI.
Wash works by reconstructing a log for the state, whereas this
approach keeps the continuation in an MVar (one per application, which
should be one per session).

I think it could be altered and extended to be serializable and work
for multiple users. I have some ideas for that which I'll be testing
(hopefully somewhere in the next couple of weeks).

I just wanted to share this as inspiration, you should definitely not
yet use this for real-world things...

-chris

Simon Michael

unread,
Dec 25, 2009, 3:17:10 PM12/25/09
to ha...@googlegroups.com
That was a pretty cool paste. PLT Scheme's webserver has some kind of serializable continuations, might be a source of
ideas.

http://docs.plt-scheme.org/web-server/stateless.html#(part._.Serializable_.Continuations)

Reply all
Reply to author
Forward
0 new messages