O'Reilly logo

Haskell Cookbook by Yogesh Sajanikar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Persistent

In this recipe, we will work with the persistent library, which has been designed to abstract the concept of defining the schema (the data models and the relationships between them), and working with a storage backend (such as SQLite, and PostgreSQL).

In this recipe, we will create a model to store the following data:

  •  User details (username, email)
  • Stock that the user is interested in (exchange, symbol)

We will use SQLite as the backend, as it does not require any installation. But the model defined here can be worked out with any persistent backend, such as PostgreSQL. The model definition in the persistent library is created through Template Haskell. Template Haskell enables programmers to generate code at compile ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required