Strict, lazy, and builder

  • Modules and types
  • Text vs bytes
  • Converting between Text and ByteString
  • Strict (“packed”) strings
  • Lazy strings
  • String builders

Here we look at two common Haskell libraries, text and bytestring, and addressing the frequently-asked question: “Why are there so many types of strings?”

We’ll examine the differences between various string types, talk about what situations in which each is appropriate, and see what functions the libraries give us to convert among them.

Modules and types

We will discuss these three types from the text package

and these three types from the bytestring package

All of these modules are intended to be used with qualified imports. Herein we use a conventional set of qualified names:

Sign up for access to the full page, plus the complete archive and all the latest content.