Programming with Types
As you come to the last chapter in this book, you’ve learned how to write useful Haskell applications using many features of the type system that help you write programs that are both safe and expressive. In nearly all the examples you’ve built throughout this book, we’ve approached Haskell’s type system as a tool that lets us write some constraints in our source code that limit what our code can do. This top-down approach is typical of most Haskell programs, but sometimes we want to encode some rules about our programs that aren’t so easy to express with simple static types. In those cases, we can turn to type level programming .
In this chapter, you’ll learn what type level programming is, and how to use it effectively in your programs, by building a series of small independent examples that show different features of type level programming. Finally, we’ll work through a capstone example where you can put all of these concepts together, along with the things you’ve learned throughout the rest of the book, to build an application that makes use of type level programming.