@@ -1,35 +1,58 @@
11% WAI-MW.tex
22\begin{hcarentry}{WAI}
33\label{wai}
4−\report{Michael Snoyman}%11/14
5−\participants{Greg Weber}
4+\report{Kazu Yamamoto}%05/16
5+\participants{Michael Snoyman, Greg Weber}
66\status{stable}
77\makeheader
88
9−The Web Application Interface (WAI) is an interface between Haskell web
10−applications and Haskell web servers. By targeting the WAI, a web framework or web application gets access to multiple deployment platforms. Platforms in use include CGI, the Warp web server, and desktop webkit.
9+WAI (Web Application Interface) is an application interface
10+between web applications and handlers in Haskell.
11+The \texttt{Application} data type is defined as follows:
1112
12−WAI is also a platform for re-using code between web applications and web frameworks through WAI middleware and WAI applications. WAI middleware can inspect and transform a request, for example by automatically gzipping a response or logging a request. The Yesod~\cref{yesod} web framework provides the ability to embed arbitrary WAI applications as subsites, making them a part of a larger web application.
13+\begin{verbatim}
14+type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
15+\end{verbatim}
1316
14−By targeting WAI, every web framework can share WAI code instead of wasting
15−effort re-implementing the same functionality. There are also some new web
16−frameworks that take a completely different approach to web development that
17−use WAI, such as webwire (FRP), MFlow (continuation-based) and dingo (GUI).
18−The Scotty~\cref{scotty} web framework also continues to be developed, and
19−provides a lighter-weight alternative to Yesod. Other frameworks- whether
20−existing or newcomers- are welcome to take advantage of the existing WAI
21−architecture to focus on the more innovative features of web development.
17+That is, a WAI application takes two arguments: a \texttt{Request} and
18+a function to send a \texttt{Response}.
19+So, the typical behavior of WAI application is
20+processing a request,
21+generating a response and
22+passing the response to the function.
2223
23−WAI applications can send a response themselves. For example, wai-app-static is used by Yesod to serve static files. However, one does not need to use a web framework, but can simply build a web application using the WAI interface alone. The Hoogle %\cref{hoogle}
24−web service targets WAI directly.
24+Historically speaking, this interface made possible to develop handlers
25+other than HTTP.
26+The WAI applications can run through FastCGI (wai-handler-fastcgi),
27+run as stand-alone (wai-handler-webkit), etc.
28+But the most popular handler is based on HTTP, of course.
29+The major HTTP handler for WAI is Warp which now provides
30+both HTTP/1.1 and HTTP/2. TLS (warp-tls) is also available.
31+New transports such as
32+WebSocket (wai-websocket) and Event Source (wai-extra)
33+can be implemented, too.
2534
26−Since the last HCAR, WAI has successfully released version 3.0, which removes dependency on any specific streaming data framework. A separate wai-conduit package provides conduit bindings, and such bindings can easily be provided for other streaming data frameworks.
35+It is possible to develop WAI applications directly.
36+For instance, Hoogle and Mighttpd2~\cref{mighttpd2} take this way.
37+However, you may want to use web application frameworks
38+such as Apiary, MFlow~\cref{mflow}, rest, Servant, Scotty~\cref{scotty}, Spock,
39+Yesod~\cref{yesod}, etc.
2740
28−The WAI community continues to grow, with new applications and web frameworks continuing to be added. We've recently started a new mailing list to discuss WAI related topics. Interested parties are strongly encouraged to join in!
41+WAI also provides \texttt{Middleware}:
42+
43+\begin{verbatim}
44+type Middleware = Application -> Application
45+\end{verbatim}
46+
47+WAI middleware can inspect and transform a request, for example by automatically gzipping a response or logging a request (wai-extra).
48+
49+Since the last HCAR, WAI has successfully released version 3.2,
50+which removes the experimental HTTP/2 module and some APIs.
51+We bumped the version from 3.0 to 3.2 for consistency with
52+Warp 3.2.
2953
3054\FurtherReading
3155\begin{compactitem}
32−\item\url{http://www.yesodweb.com/book/wai}
3356\item\url{https://groups.google.com/d/forum/haskell-wai}
3457\end{compactitem}
3558\end{hcarentry}