Difference between revisions of "Web"

From HaskellWiki
Jump to navigation Jump to search
(move Salvia to other, remove number)
(finish merging to Web/Frameworks and Web/Deploy)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
The web development community in Haskell has recently had a large boost in activity, resulting in a plethora of choices in libraries. As usual, a breadth of options is a double edged sword: you can choose the tools more to your style, but it is harder to find quality tools.
 
The web development community in Haskell has recently had a large boost in activity, resulting in a plethora of choices in libraries. As usual, a breadth of options is a double edged sword: you can choose the tools more to your style, but it is harder to find quality tools.
   
 
You may want to start on this wiki by looking at [[Web/Frameworks]].
Rather than one framework to rule them all, Haskell provides several options.
 
On this page we show a non-inclusive list of options to help the Haskell web programming newbie find which libraries and frameworks work together.
 
   
 
Please join us on [[Web/Forums_and_Discussion|the mailing lists]] to discuss web development in Haskell.
 
Please join us on [[Web/Forums_and_Discussion|the mailing lists]] to discuss web development in Haskell.
 
Content on this page should be merged with [[Web/Frameworks]]
 
 
== Happstack ==
 
 
[http://happstack.com/index.html Happstack] is a complete web framework. It is organized as a suite of libraries including:
 
* happstack-server: an integrated HTTP server, routing combinators, fileserving, etc
 
* happstack-data: datatype serialization and migration support
 
* happstack-state (aka macid): an (optional) powerful NoSQL ACID storage system with native support for Haskell types and replication
 
 
It also includes integration with many 3rd party libraries including:
 
 
*templating: [http://hackage.haskell.org/package/blaze-html Blaze HTML combinator library], [http://docs.yesodweb.com/ Hamlet], [[HSP]], [[HStringTemplate]], [[Heist]], and more
 
*forms: [[Formlets]]
 
*routing: [http://hackage.haskell.org/package/web-routes web-routes] type-safe urls and routing
 
*databases: can be used with most [[Database interfaces]] with no special support required
 
 
Happstack is primarily intended for use on VPS or dedicated hosts, but can be used with CGI via FastCGI or [http://hackage.haskell.org/package/hack-handler-happstack-2009.12.20 hack].
 
 
See the [http://happstack.com/index.html Happstack Home Page] for more information and to learn how to get support via IRC and mailing lists.
 
 
== Yesod + Warp ==
 
 
[http://docs.yesodweb.com/ Yesod] is a full-featured web framework. It takes a modular approach to development, so many parts of the framework such as [http://docs.yesodweb.com/book/templates Hamlet] and [http://docs.yesodweb.com/book/persistent Persistent] are available as standalone packages. However, put together, Yesod provides you with solutions for templating, routing, persistence, sessions, JSON, authentication/authorization, and more. Yesod's major guiding principle is type safety: if your application compiles, it works.
 
 
Yesod is very well documented through the [http://docs.yesodweb.com/book Yesod book]. Work is being done on an constant basis to improve the documentation status, but the first ten chapters (covering all the basics) are already done, so it should be easy to get started.
 
 
Yesod is built on [http://hackage.haskell.org/package/wai WAI], or the Web Application Interface. This is similar to WSGI in Python or Rack in Ruby. It provides a single interface that all applications can target and work on multiple backends. Backends exist for CGI, FastCGI, SCGI, development server (auto-recompile) and even a Webkit-powered desktop version.
 
 
But the premier backend is [http://hackage.haskell.org/package/warp Warp]: a very simple web server which, at the time of writing, is the fastest Haskell has to offer. You can read more in its [http://docs.yesodweb.com/blog/announcing-warp release announcement] and see some [http://docs.yesodweb.com/blog/warp-speed-ahead followup benchmarks]. Warp is already powering Yesod; some other major players that are planning a move are Hoogle and Happstack.
 
 
You can see a [http://wiki.yesodweb.com/Powered%20by%20Yesod list of Yesod-powered sites and packages], or check out the [https://github.com/snoyberg/haskellers source code for Haskellers]. Most discussions for Yesod take place on the [http://www.haskell.org/mailman/listinfo/web-devel web-devel list], so feel free to join in and ask any questions you have, the Yesod community is very beginner-friendly.
 
 
== (Fast)CGI + WAI + Yesod ==
 
 
This option is similar to Option 2 except we use a webserver like [http://nginx.org/ nginx], [http://www.lighttpd.net/ lighttpd], or [http://www.apache.org/ Apache]. These servers would communicate with your web applications using CGI or FastCGI. See [http://hackage.haskell.org/package/wai-handler-fastcgi wai-handler-fastcgi] for a library which connects FastCGI with the WAI interface. A [http://www.google.co.uk/search?hl=en&as_sitesearch=hackage.haskell.org%2Fpackage&as_q=wai-handler search] for wai-handler shows the various options available. See the [http://docs.yesodweb.com/book/deploying/ deployment] chapter of the Yesod book to see how to configure the various servers and FastCGI to host WAI applications.
 
 
 
== Snap + custom code + libraries ==
 
 
In this option, you would write your website to directly use the [http://snapframework.com/ Snap] server. Instead of using an interface like WAI, you would receive requests and generate responses directly to the snap server. Look through the [http://snapframework.com/docs Snap documentation] to get started using this option.
 
There are a plethora of libraries to help you:
 
 
* Snap's templating library called [http://snapframework.com/docs/tutorials/heist Heist], some other [[Web/Libraries/Templating|templating library]] or the [http://hackage.haskell.org/package/blaze-html Blaze HTML combinator library].
 
* Some [[Web/Databases_and_Persistence|database Access or Persistence]] library.
 
* The [[Formlets]] library for coding forms.
 
* See [[Web/Libraries|Libraries]] for a list of some other helpful libraries.
 
 
== (Fast)CGI + custom code + libraries ==
 
 
This is very similar to the previous option, but using CGI or FastCGI to talk to another web server. See this [[Web/Literature/Practical_web_programming_in_Haskell|tutorial on simple CGI programming]] for a simple example.
 
 
== Other ==
 
 
Something not listed on this page. There are several web frameworks or libraries in various stages of development like
 
Salvia,
 
[http://github.com/larrytheliquid/Lemmachine#readme Lemmachine], [http://haskell.on-a-horse.org/ Haskell on a Horse], [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mohws mohws], [http://hackage.haskell.org/package/loli loli], plus probably others which are not listed.
 
 
There are also many inactive frameworks to draw inspiration from
 
[[Web/Frameworks/Inactive]]
 

Latest revision as of 20:04, 17 February 2011

Haskell Web Development

Software:
Servers - Libraries - Frameworks
Deploy - Cloud
Interfaces to frameworks
Databases and Persistence
Testing and Verification
Content Management

Community & Research:
Forums and Discussion
Literature (research, talks and blogs)
Existing Haskell web applications
Ongoing projects and ideas

The web development community in Haskell has recently had a large boost in activity, resulting in a plethora of choices in libraries. As usual, a breadth of options is a double edged sword: you can choose the tools more to your style, but it is harder to find quality tools.

You may want to start on this wiki by looking at Web/Frameworks.

Please join us on the mailing lists to discuss web development in Haskell.