The various forms of Text and ByteString

I took a side track from the Web Servers course to write a page about the text and bytestring packages.

This topic isn’t a tremendously complicated, but it can be difficult because it is rather tedious. I remember it as a source of endless frustration when I was first learning Haskell: Why so many strings? Why do I have to waste my time looking up functions to convert between different representations (lazy, strict, builder) of the same thing?

It turns out these types all exist for a reason, and once you understand these reasons, it should become clear why we actually do care about which type we’re using and when we convert between them.

In Web Servers lesson 4 we’re going to be using Builder Data.ByteString.Builder to construct HTTP responses, so Strict, lazy, and builder will be an important supplement to that part of the course.