* A simple, yet powerful template system that supports both HTML5 and XML

* A simple, yet powerful template system that supports both HTML5 and XML

−

Snaplets that come with the framework include functionality for templating, authentication and sessions. Additional functionality (including MySQL and PostsgreSQL database access) is provided by third-party snaplets.

+

Snaplets that come with the framework include functionality for templating, authentication and sessions. Additional functionality (including MySQL and PostgreSQL database access) is provided by third-party snaplets.

Below is a list of known to be active Haskell web frameworks. Rather than one framework to rule them all, Haskell provides several options. You can view the Web/Deploy page to get an idea of how you might deploy an application written in some of these frameworks.

Happstack is a complete web framework. The main component is happstack-server: an integrated HTTP server, routing combinators, fileserving, etc. In addition, a number of packages that used to be coupled to Happstack have now been decoupled from it, but remain promoted and documented for use with Happstack:

See the Happstack Home Page for more information and to learn how to get support via IRC and mailing lists.

Snap

Snap is a web development framework built around an abstraction called snaplets.

Snap is well-documented and has a test suite with a high level of code coverage. It has been used in production for years, and version 1.0 was released in August 2016. As of July 2017, it does not support HTTP/2.

A simple, yet powerful template system that supports both HTML5 and XML

Snaplets that come with the framework include functionality for templating, authentication and sessions. Additional functionality (including MySQL and PostgreSQL database access) is provided by third-party snaplets.

Yesod

Yesod is designed for RESTful, type-safe, performant web apps. By leveraging quasi-quotation for the more boilerplate tasks, we get concise web apps with high levels of type safety. Its Hamlet templates are compile-time checked for correctness, and the controller (web-routes-quasi) uses type-safe URLs to make certain you are only generating valid URLs. It loosely follows Model/View/Controller principles.

Yesod is a full-featured web framework. It takes a modular approach to development, so many parts of the framework such as Hamlet and 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 a combination of haddocks and the Yesod book.

Yesod is built on 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 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 release announcement and see some followup benchmarks. Warp is already powering Yesod; some other major players that are planning a move are Hoogle and Happstack.

Lemmachine

Lemmachine is a REST'ful web framework that makes it easy to get HTTP right by exposing users to overridable hooks with sane defaults. The main architecture is a copy of Erlang-based Webmachine, which is currently the best documentation reference (for hooks & general design).

Lemmachine stands out from the dynamically typed Webmachine by being written in dependently typed Agda. The goal of the project is to show the advantages gained from compositional testing by taking advantage of proofs being inherently compositional. See proofs for examples of universally quantified proofs (tests over all possible input values) written against the default resource, which does not override any hooks.

Salvia

Salvia is a feature rich modular web server and web application framework that can be used to write dynamic websites in Haskell. From the lower level protocol code up to the high level application code, everything is written as a Salvia handler. This approach makes the server extremely extensible. To see a demo of a Salvia website, please see the salvia-demo package.

All the low level protocol code can be found in the salvia-protocol package, which exposes the datatypes, parsers and pretty-printers for the URI, HTTP, Cookie and MIME protocols.

This Salvia package itself can be separated into three different parts: the interface, the handlers and the implementation. The interface module defines a number of type classes that the user can build the web application against. Reading the request object, writing to the response, or gaining direct access to the socket, all of these actions are reflected using one type class aspect in the interface. The handlers are self contained modules that implement a single aspect of the Salvia web server. The handlers expose their interface requirements in their type context. Salvia can have multiple implementations which can be switched by using different instances for the interface type classes. This package has only one implementation, a simple accepting socket loop server. The salvia-extras package has two additional implementations. Keeping a clear distinction between the abstract server aspects and the actual implementation makes it very easy to migrate existing web application to different back-ends.

Miso

Miso is a small "isomorphic" Haskell front-end framework featuring a virtual-dom, diffing / patching algorithm, event delegation, event batching, SVG, Server-sent events, Websockets, and an extensible Subscription-based subsystem. Inspired by Elm, Redux and Bobril. IO and other effects (like XHR) can be introduced into the system via the Effect data type. Miso makes heavy use of the GHCJS FFI and therefore has minimal dependencies.

Servant

Servant is a a light-weight framework primarily for REST APIs. It allows to specify API specifications as type aliases and then work with these type aliases to create servers, but also documentation, client code in Haskell and Javascript, etc.. It is based on wai.

MFlow

A Haskell application server ++ Web Framework. MFlow is a shorthand for "Message Flow". It is a continuation-based framework without continuations. Instead of other continuation based frameworks like Ocsigen(Ocaml), Coccoon (javascript) or Seaside (Smalltalk), it is based on a backtracking monad that keep the synchornization of the execution state with the user navigation. Since the discontinuation of WASH, MFlow is the only continuation-style framework written in Haskell to date.

Unlike real continuations, the state in MFlow applications is pretty small and serializable, so it is horizontally scalable. The navigation in a MFlow application is safe at compilation time, since even the internal HTML links are checked by the compiler. The code is very short and has little configuration. Routes in MFlow are defined and typechecked in pure haskell code, just like in the case of the menus in a console application. Each page has its own URL so it is RESTful to a certain extent. It is planned to have REST-style URLs in the future (done in the head of the github repo).

It uses standard Haskell web libraries and/or techniques: WAI, Warp, Blaze HTML, HSP. Its core is server and rendering independent. A kind of extended formlets are used to create self contained components, called widgets. They have formatting, Ajax, and server code. They can be composed to create the user interface.

A MFlow application resembles a console application. This is an example of a complete application with three pages. It ask for two numbers and return the sum. At any time, even if the user press the back button, the state is synchronized with the navigation.

Wheb

Wheb's a WAI framework for building robust, high-concurrency web applications simply and effectively. Its primary goal is to extend the functionality of the base WAI library and to provide an easy entry point into Haskell web servers. The only prerequisite is "Learn you a Haskell" or another introductory Haskell course. It comes with lots of examples on the github page.

The core datatype will let you build anything from a read-only server to a fully interactive web application with basic Haskell.

Minimal boilerplate to start your application.

Session, Auth and Cache interfaces are built in. Just drop in a backend.

Wheb makes it easy to write plugins. Plugins can add routes, middleware, settings and even handle resource cleanup on server shutdown. Named routes allow plugins to dynamically generate their routes at runtime based on settings.

WebApi

WebApi is a light weight, WAI based library that lets you define your requests and responses for end-points as types by means of a contract. The contract is considered the single source of truth, using which WebApi lets you to

Write Web/REST API services

Generate Haskell client for existing API services

Generate mock server to mock requests and responses

WebApi makes use of the strong type system of haskell which lets to

Create a type safe routing system.

Enable type safe generation of links.

Specify a contract for the APIs.

Auto serialization and deserialization of the request and response based on api contract.