The fourth draft of Sockets and Pipes is now available on Leanpub! It includes chapter 10, Change, which deals with using STM to add a stateful component to the web server.
Another new thing: We just published the sockets-and-pipes library on Hackage to accompany the book.
It re-exports the modules that we use, and so it ought to serve as a handy collection of links to all the relevant API documentation. It should also make it a little easier to set up your local environment to do the exercises, since
sockets-and-pipes should now be the only dependencies you need to install.
To reduce the number of libraries we need to rely on, the book no longer refers to the
network-simple package. In previous drafts,
network-simple was introduced at the end of chapter 5 to make use of its
serve function. We now use our own
serve function provided by the
sockets-and-pipes library, which has a slightly different type signature more tailored to the book’s particular use case.
The next chapter will deal with sending HTTP message bodies in the “chunked” format that does not require determining the length of the entire message upfront. Then several chapters on parsing will follow, which will get us to a point where the server can read HTTP requests.
Please enjoy the TVars! They are one of my favorite unsung features of Haskell.