Trying On Learn Haskell Web Server

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying On Learn Haskell Web Server

Aditya Siram
Hi all,
I am former imperative programmer (Java/C/Python) I have recently discovered
Haskell and read through "Yet Another Haskell Tutorial" (the best I have
found) and "Tackling The Awkward Squad". This paper mentions a Haskell Web
Server (HWS) but I am not able to find the source.

Where can I find the source? Has this code been updated since the paper was
written? Can it be compiled and run on a recent version of GHC?Hugs? I would
like to use it as an example program to teach myself Haskell.


Thanks...
Deech


_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Trying On Learn Haskell Web Server

Cale Gibbard
Looks like there's an updated version here which supports dynamically
loadable plugins: http://www.mdstud.chalmers.se/~md9ms/hws-wp/

 - Cale
_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Trying On Learn Haskell Web Server

Shae Matijs Erisson
"Cale Gibbard" <[hidden email]> writes:

> Looks like there's an updated version here which supports dynamically
> loadable plugins: http://www.mdstud.chalmers.se/~md9ms/hws-wp/

Peter Thiemann has a more recent version that uses hs-plugins:
http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/
--
I've tried to teach people autodidactism,                | ScannedInAvian.com
but it seems they always have to learn it for themselves.| Shae Matijs Erisson

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying On Learn Haskell Web Server

Cale Gibbard
On 06/03/06, Shae Matijs Erisson <[hidden email]> wrote:
> "Cale Gibbard" <[hidden email]> writes:
>
> > Looks like there's an updated version here which supports dynamically
> > loadable plugins: http://www.mdstud.chalmers.se/~md9ms/hws-wp/
>
> Peter Thiemann has a more recent version that uses hs-plugins:
> http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/

Ah, neat, I knew about WASH, but somehow I'd missed the fact that
there was a server there :)

 - Cale
_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying On Learn Haskell Web Server

Graham Klyne-2
Cale Gibbard wrote:
> Ah, neat, I knew about WASH, but somehow I'd missed the fact that
> there was a server there :)

Interesting... at a casual glance, this looks as if it could be coming close to
being a "full stack web application framework" for Haskell, looking to occupy
the same kind of territory as systems like Java/Servlets+JSP+the rest,
Ruby/Rails or Python/Turbogears (the last a package I'm currently using).

I think see:
  The web server
  CGI process dispatching
  Web page templating
  Relational database access

Additional features of a full-stack web application framework that may or may
not be present are:

- Support for longer-running web processes (implemented in haskell, of course)

- An easy way to map incoming URIs to specific functions (hmm.. or to monadic
values, I think)

- Easy mapping from Haskell data structures to underlying SQL - what would be
called an Object-Relational Mapper (ORM) in OO languages

- Handling of interaction with a browser-side Javascript library for smoother
AJAX support

- Options to run the whole thing behind Apache to leverage its security and web
space management capabilities

I think that continuation-based web session state management, ala
Smalltalk/Seaside, would be a very natural fit for a Haskell framework -- all
handled by a "Web session monad", maybe.  (Or maybe I just don't know what I'm
talking about ;)

How far are we from having such a framework for Haskell?

#g
--

Cale Gibbard wrote:

> On 06/03/06, Shae Matijs Erisson <[hidden email]> wrote:
>> "Cale Gibbard" <[hidden email]> writes:
>>
>>> Looks like there's an updated version here which supports dynamically
>>> loadable plugins: http://www.mdstud.chalmers.se/~md9ms/hws-wp/
>> Peter Thiemann has a more recent version that uses hs-plugins:
>> http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/
>
> Ah, neat, I knew about WASH, but somehow I'd missed the fact that
> there was a server there :)
>
>  - Cale
> _______________________________________________
> Haskell mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell
>

--
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Trying On Learn Haskell Web Server

S. Doaitse Swierstra-2
In reply to this post by Aditya Siram
You may find some useful code (that is still in need of  
beautification, but on the other hand: it works) at:

http://www.cs.uu.nl/wiki/WebFunctions

Doaitse Swierstra




On 2006 mrt 03, at 20:30, Aditya Siram wrote:

> Hi all,
> I am former imperative programmer (Java/C/Python) I have recently  
> discovered Haskell and read through "Yet Another Haskell  
> Tutorial" (the best I have found) and "Tackling The Awkward Squad".  
> This paper mentions a Haskell Web Server (HWS) but I am not able to  
> find the source.
>
> Where can I find the source? Has this code been updated since the  
> paper was written? Can it be compiled and run on a recent version  
> of GHC?Hugs? I would like to use it as an example program to teach  
> myself Haskell.
>
>
> Thanks...
> Deech
>
>
> _______________________________________________
> Haskell mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying On Learn Haskell Web Server

Niklas Broberg
In reply to this post by Graham Klyne-2
Ehum, shameless plug. :)

On 3/6/06, Graham Klyne <[hidden email]> wrote:
> Cale Gibbard wrote:
> > Ah, neat, I knew about WASH, but somehow I'd missed the fact that
> > there was a server there :)
>
> Interesting... at a casual glance, this looks as if it could be coming close to
> being a "full stack web application framework" for Haskell, looking to occupy
> the same kind of territory as systems like Java/Servlets+JSP+the rest,
> Ruby/Rails or Python/Turbogears (the last a package I'm currently using).

Have you looked at HSP [1]? This is exactly what the HSP project aims
for, although there is quite some ways to go yet.

> I think see:
>   The web server
>   CGI process dispatching
>   Web page templating
>   Relational database access

All of these are present in HSP.

> Additional features of a full-stack web application framework that may or may
> not be present are:
>
> - Support for longer-running web processes (implemented in haskell, of course)

HSP has that.

> - An easy way to map incoming URIs to specific functions (hmm.. or to monadic
> values, I think)

I don't think I understand what you're after exactly, but I'm sure
it's interesting, care to explain a bit further? :-)

> - Easy mapping from Haskell data structures to underlying SQL - what would be
> called an Object-Relational Mapper (ORM) in OO languages

Some of our students are working on bringing the power of Ruby/Rails
to HSP, with emphasis on smooth database interfacing. Not sure exactly
what this entails though, I've never used Rails... :-)

>
> - Handling of interaction with a browser-side Javascript library for smoother
> AJAX support

This is not currently present in HSP, but they are surely on the
conceptual todo-list. There is a design for a crude JavaScript
support, but we'd certainly need more.

> - Options to run the whole thing behind Apache to leverage its security and web
> space management capabilities

Lemmih has implemented a HSP/FastCGI binding for Apache. I also know
that work is being done on building a direct HSP/Apache binding. All
work in progress though.

> I think that continuation-based web session state management, ala
> Smalltalk/Seaside, would be a very natural fit for a Haskell framework -- all
> handled by a "Web session monad", maybe.  (Or maybe I just don't know what I'm
> talking about ;)

This is by far the biggest drawback of HSP today. There is no
high-level support for continuations (other than explicitly defined
continuations at top level).

> How far are we from having such a framework for Haskell?

Depends on how many people would be willing to invest time in it.
Right now we have students at Chalmers working on a project that aims
towards such a framework, but they can only do so much in the time
they have. We would surely welcome any help we could get. :-)

/Niklas

(ps. Going on vacation for 2 weeks in a few hours, so I'm not likely
to respond for a while... ;-))

[1] http://www.cs.chalmers.se/~d00nibro/hsp/
_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying On Learn Haskell Web Server

Mattias Bengtsson

On Tue, 2006-03-07 at 00:06 +0100, Niklas Broberg wrote:
> On 3/6/06, Graham Klyne <[hidden email]> wrote:
> > - An easy way to map incoming URIs to specific functions (hmm.. or to monadic
> > values, I think)
>
> I don't think I understand what you're after exactly, but I'm sure
> it's interesting, care to explain a bit further? :-)

Hm, i remember seeing this in ruby on rails i think.
You would like to be able to map http://www.domain.com/show or
http://www.domain.com/show etc. to haskell-functions that spits out
webpages. With all this defined in one file?

> > - Easy mapping from Haskell data structures to underlying SQL - what would be
> > called an Object-Relational Mapper (ORM) in OO languages
>
> Some of our students are working on bringing the power of Ruby/Rails
> to HSP, with emphasis on smooth database interfacing. Not sure exactly
> what this entails though, I've never used Rails... :-)
>

This is basically some sort of database abstraction which is somewhat
inspired by ActiveRecord in Rails. In short we let the programmer define
its database in a spec-file. Mostly things you'd do anyway using a list
of CREATE TABLE in an SQL-file.
However we have a different syntax and some extra attributes that can be
set to define what sort of relations different tables has to each other
(one to one, one to many and many to many). We plan on extending this
later (maybe software TRIGGER's and CASCADE'ing and some sort of
contstraints).

This spec-file is then supposed to create an empty database conforming
to the spec and Haskell modules containing HaskellDB defintions together
with generated helper functions for retreiving data from your database.
This together with support for "Higher Order Queries" should make it
both easy and fast to do database actions without giving up on
flexibility. At least that is our goal.

> >
> > - Handling of interaction with a browser-side Javascript library for smoother
> > AJAX support
>
> This is not currently present in HSP, but they are surely on the
> conceptual todo-list. There is a design for a crude JavaScript
> support, but we'd certainly need more.

This is quite important.

> > - Options to run the whole thing behind Apache to leverage its security and web
> > space management capabilities
>
> Lemmih has implemented a HSP/FastCGI binding for Apache. I also know
> that work is being done on building a direct HSP/Apache binding. All
> work in progress though.

Yes. Two guys in my group is working on this. Haven't made any progress
as of yet though.

> > I think that continuation-based web session state management, ala
> > Smalltalk/Seaside, would be a very natural fit for a Haskell framework -- all
> > handled by a "Web session monad", maybe.  (Or maybe I just don't know what I'm
> > talking about ;)
>
> This is by far the biggest drawback of HSP today. There is no
> high-level support for continuations (other than explicitly defined
> continuations at top level).

I would really like to know exactly what this means. Are there any
examples or papers on this?

> > How far are we from having such a framework for Haskell?
>
> Depends on how many people would be willing to invest time in it.
> Right now we have students at Chalmers working on a project that aims
> towards such a framework, but they can only do so much in the time
> they have. We would surely welcome any help we could get. :-)

Hopefully we will a real homepage up pretty soon and tell the world what
we are working on. Hopefully some of us would like to actively continue
on this project after spring when we need to show something.

Mattias

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Trying On Learn Haskell Web Server

Shae Matijs Erisson
In reply to this post by Graham Klyne-2
Graham Klyne <[hidden email]> writes:

> - Easy mapping from Haskell data structures to underlying SQL - what would be
> called an Object-Relational Mapper (ORM) in OO languages

For this, what about SerTH[1] on top of HaskellDB?

[1] http://www.cs.helsinki.fi/u/ekarttun/SerTH/
--
I've tried to teach people autodidactism,                | ScannedInAvian.com
but it seems they always have to learn it for themselves.| Shae Matijs Erisson

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying On Learn Haskell Web Server

Bulat Ziganshin-2
Hello Shae,

Friday, March 10, 2006, 5:19:19 PM, you wrote:

>> - Easy mapping from Haskell data structures to underlying SQL - what would be
>> called an Object-Relational Mapper (ORM) in OO languages

SME> For this, what about SerTH[1] on top of HaskellDB?

my Streams library contains even better serialization abilities. it's
still undocumented, though. if someone need a serialization lib,
please yell me - as true lazy programmer, i better work on demand ;)

just a list of features implemented in this lib:

- class-based AltBinary interface plus emulation of NewBinary library interface
- compatibility with Hugs and GHC, with GHC-specific speed optimizations
- (de)serialization speed of 20-60 mb/sec on 1GHz CPU
- free intermixing of text and binary i/o on the same Stream
- support for byte-aligned and bit-aligned, low-endian and big-endian
    serialization using the same interface
- classical Binary class with "get" and "put_" functions defines
    default representation for each type
- get/put_ uses fixed-size encoding for Int8..Word64, but variable-length encoding
    for Int/Word/Integer (including encoding of array bounds and list lengths)
- any integral value can be saved with explicitly specified size using
    functions "putBits bh bits value" and "getBits bh bits" (their shortcuts
    putBit/putWord8...putWord64/getBit/... is also supported for all integral types)
- get/put_ uses UTF8 encoding for strings/chars
- Binary class instances (i.e. get/put_ implementation) for Bounded Enum,
    Storable and all array types
- lots of alternative representations for Strings, lists and arrays,
    including ability to use user-supported function to read/write
    each list/array element, such as "putMArrayWith (putBits 15) h arr".
    for example, "putString0With (latin1Encode.putWord8) h s" implements
    ASCIIZ string encoding
- Template Haskell used to automatically derive new Binary instances
- ability to serialize data to any Stream, including Handle, raw
    files, memory-mapped files, memory and string buffers, pipes,
    network sockets and so on
- after all, it can work in any monad. the only thing required for
    it's work is something supporting ByteStream interface, i.e.
    implementing vGetByte and vPutByte operations in some monad

... and i still not mentioned some features such as (encode :: a->String)
and decode functions. i think that i implemented in this lib
everything that anyone (except for Einar ;)) ever imagined :)

--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Haskell mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell