[Haskell-cafe] Where to start about writing web/HTTP apps ?

Brian McQueen mcqueenorama at gmail.com
Sat Sep 10 21:00:58 EDT 2005


I emailed the WASH guy the other day and he is currently working on
integrating it with a web server.  There is talk about Haskell server
pages.  It sounds quite interesting.  I'm impressed with WASH as it
is, though.  I too am hoping to see it when it moves from a plain CGI
model to the something that's built right into the server.  There are
some very useful and intersting features such as the way you program
as if it were a resident server, rather than a remote, swtateless exec
and restart CGI.  I like the way handlers for the input fields are
integrated with the definition of the field, as well as with the error
handling for the field.  I saw something about caching of the static
portion of the pages too.

I'd like to see some means of integrating the new, and quite awesome
AJAX techniques too.

Brian McQueen

On 9/10/05, Thomas Spriggs <thomasspriggs at hotmail.com> wrote:
> >From: gary ng <garyng2000 at yahoo.com>
> >To: haskell-cafe at haskell.org
> >Subject: [Haskell-cafe] Where to start about writing web/HTTP apps ?
> >Date: Sat, 10 Sep 2005 04:15:45 -0700 (PDT)
> >
> >Hi,
> Hi,
> >
> >I just start learning haskell and have to say that it
> >is stunning in how precise it can be(coming from a
> >background of C then python/perl/js).
> >
> >I want to write apps for WEB and have briefly read
> >WASH. However, that seems to be a CGI based solution.
> >What I want is a native HTTP server(written in
> >haskell), like Twisted/Cherrypy in Python. Are there
> >any boilerplate(I know I should scrap the boilerplate
> >but I need to have something to get start) for
> >reference ?
> >
> >In addition, during my learning process, I keep on
> >using my old experience as reference such as writing
> >simple programs that needs functions like
> >ltrim/rtrim/substr etc. that is in almost any language
> >I have used. But it seems that haskell doesn't have
> >it. I know that a haskell expert can write them in no
> >time with things like dropWhile and reverse, it is a
> >bit frustrating for new comers from a imperative
> >background.
> >
> >Oh, while I am still here, I am reading "The Evolution
> >of a Haskell Programmer"
> >http://www.willamette.edu/~fruehr/haskell/evolution.html
> >
> >and learning the various way to tackle the same
> >problem. Obviously, there are lots of things I don't
> >know what it is about and I would tackle them as time
> >go by. But I have problem even with the seems to be
> >simple one like this :
> I don't think its that simple.
> >
> >fac n = foldr (\x g n -> g (x*n)) id [1..n] 1
> >
> >I can understand a foldl or foldr version but have
> >problem with this, especially the "id" and the
> The id is the identity function defined
> id x = x
> >trailing "1" and the function being folded takes 3
> >parameters instead of 2(as in standard foldr/foldl
> >solution).
> >
> For a start the previous standard fold solutions take 3 parameters not 2.
> Its just the "fac n = foldr (\x g n -> g (x*n)) id [1..n] 1" example appears
> to take 4. However it doesn't, foldr always takes 3 arguments.
> foldr :: (a -> b -> b) -> b -> [a] -> b (from zvon reference)
> In fact the foldr function actually returns a function in this case. It
> could be rewritten as
> fac n = (foldr (\x g n -> g (x*n)) id [1..n]) 1
> with the additional brackets added for clarity.
> 
> >Would appreciate if someone can knock on my head and
> >tell me what is going on in it.
> Well, here goes. The way the lambda function/foldr thing evaluates, the
> resulting foldl like function needs a new identity parameter hence the
> additional "1". To demonstrate something like how this is evaluated for a
> low number eg 3: (Please would someone correct me if I have made a mistake
> in this)
> fac 3 = (foldr (\x g n -> g (x*n)) id [1..3]) 1
> fac 3 = (foldr (\x g n -> g (x*n)) id [1,2,3]) 1
> fac 3 = (foldr (\x g n -> g (x*n)) (\n -> id (3*n)) [1,2])) 1
> fac 3 = (foldr (\x g n -> g (x*n)) (\n -> (\n -> id (3*n)) (2*n)) [1]) 1
> fac 3 = (foldr (\x g n -> g (x*n)) (\n -> (\n -> (\n -> id (3*n)) (2*n))
> (1*n)) []) 1
> fac 3 = (\n -> (\n -> (\n -> id (3*n)) (2*n)) (1*n)) 1
> fac 3 = (\n -> (\n -> id (3*n)) (2*n)) (1*1)
> fac 3 = (\n -> (\n -> id (3*n)) (2*n)) 1
> fac 3 = (\n -> id (3*n)) (2*1)
> fac 3 = (\n -> id (3*n)) 2
> fac 3 = id (3*2)
> fac 3 = id 6
> fac 3 = 6
> I would suggest that you use something other than the "evolution of a
> haskell programmer" to learn haskell as the versions of factorial get
> complicated very quickly and its largely use less as you should probably
> just use:
> fac n = product [1..n]
> anyway. A better introduction would be something like
> http://www.cse.unsw.edu.au/~cs1011/05s2/ and use
> http://zvon.org/other/haskell/Outputglobal/index.html and
> http://www.haskell.org/tutorial/ if you want to learn something in specific
> or are strugling. All links from http://www.haskell.org/learning.html of
> course.
> >
> >thanks for help in advance.
> You're welcome.
> >
> >regards,
> >
> >gary
> >
> >
> >
> >
> >______________________________________________________
> >Click here to donate to the Hurricane Katrina relief effort.
> >http://store.yahoo.com/redcross-donate3/
> >_______________________________________________
> >Haskell-Cafe mailing list
> >askell-Cafe at haskell.org
> >http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> Well good luck furthering your knowledge of haskell,
> 
> Thomas
> 
> _________________________________________________________________
> Be the first to hear what's new at MSN - sign up to our free newsletters!
> http://www.msn.co.uk/newsletters
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list