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

How it works...

In this recipe, we have touched upon many aspects of defining, storing, and querying the model. Let's us look at each aspect one by one.

The definition of the model starts with the following statement: 

    share [mkPersist sqlSettings, mkMigrate "migrateAll"] 

This definition shows how we would like to persist the model. sqlSettings denotes that we would like to use a SQL backend for storing the model. mkMigrate takes a string argument. This should be name of the function (in this case, migrateAll) that represents the creation of all the schemata defined in the model.

The model itself is defined within [persistLowerCase| ...]. It persists the names of tables and fields using lowercase letters. The following definition of Stock ...

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