Web servers course
No instruction about a programming language is complete without “how to build a webapp,” right?
When I started planning this course, it was going to be an overview of Haskell’s web server libraries, sorted in order of increasing complexity: the basic platform of wai, warp, and http-types, then the slightly more opinionated packages like scotty and Spock, up through the full-fledged yesod framework. All good things in software are built, and can be best understood, as the result of combining smaller things. The idea was to emphasize how a complete application is composed of comprehensible smaller pieces, so you can better understand how to use a heavyweight application framework, and so you can recognize circumstances where you don’t need one.
But I grew increasingly uncomfortable with choosing Warp as the starting point for the course. It just seemed like a missed opportunity, because we can go deeper: We can show a server implementation all the way down to parsing HTTP requests and writing byte strings to sockets. You might expect to quickly get lost in the weeds, but… as I hope to you convince you, Haskell has an amazing illuminatory quality if you write it simply and directly.
The major course objective is twofold:
I’ll be releasing this one lesson at a time. What I have finished planning so far covers HTTP protocol, the chunked transfer coding, parsing requests, and building responses. Lesson 1 lays the foundation by introducing sockets, and in lesson 2 we start reading the HTTP specification and writing some code.