Lesson 33. Capstone: SQL-like queries in Haskell

This capstone covers

  • Using the Monad type class to create SQL-like queries on lists
  • Generalizing functions written for one Monad (for example, List) to many
  • Organizing functions with types

In the preceding lesson, you saw how List as a Monad can also be understood as a list comprehension, which is used heavily in Python. In this capstone, you’re going to take your use of lists and monads one step further to create a SQL-like interface to lists (and other monads). SQL is used as the primary means to query relational databases. It has a clean syntax for representing the relationships between data. For example, if you had data about teachers teaching classes, you could query the teachers teaching ...

Get Get Programming with Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.