on wai-extra/3.0.19 help sign in
typeable/wai/hcar-wai.tex
58 lines 2.0 kB history raw
1% WAI-MW.tex
2\begin{hcarentry}{WAI}
3\label{wai}
4\report{Kazu Yamamoto}%05/16
5\participants{Michael Snoyman, Greg Weber}
6\status{stable}
7\makeheader
9WAI (Web Application Interface) is an application interface
10between web applications and handlers in Haskell.
11The \texttt{Application} data type is defined as follows:
13\begin{verbatim}
14type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
15\end{verbatim}
17That is, a WAI application takes two arguments: a \texttt{Request} and
18a function to send a \texttt{Response}.
19So, the typical behavior of WAI application is
20processing a request,
21generating a response and
22passing the response to the function.
24Historically speaking, this interface made possible to develop handlers
25other than HTTP.
26The WAI applications can run through FastCGI (wai-handler-fastcgi),
27run as stand-alone (wai-handler-webkit), etc.
28But the most popular handler is based on HTTP, of course.
29The major HTTP handler for WAI is Warp which now provides
30both HTTP/1.1 and HTTP/2. TLS (warp-tls) is also available.
31New transports such as
32WebSocket (wai-websocket) and Event Source (wai-extra)
33can be implemented, too.
35It is possible to develop WAI applications directly.
36For instance, Hoogle and Mighttpd2~\cref{mighttpd2} take this way.
37However, you may want to use web application frameworks
38such as Apiary, MFlow~\cref{mflow}, rest, Servant, Scotty~\cref{scotty}, Spock,
39Yesod~\cref{yesod}, etc.
41WAI also provides \texttt{Middleware}:
43\begin{verbatim}
44type Middleware = Application -> Application
45\end{verbatim}
47WAI middleware can inspect and transform a request, for example by automatically gzipping a response or logging a request (wai-extra).
49Since the last HCAR, WAI has successfully released version 3.2,
50which removes the experimental HTTP/2 module and some APIs.
51We bumped the version from 3.0 to 3.2 for consistency with
52Warp 3.2.
54\FurtherReading
55\begin{compactitem}
56\item\url{https://groups.google.com/d/forum/haskell-wai}
57\end{compactitem}
58\end{hcarentry}