How to do it...

  1. Create a new project called managing-migrations with the simple stack template:
        stack new managing-migrations simple
  1. Add dependencies on the persistentpersistent-templatepersistent-sqlitetext, and mtl libraries in the build-depends sub-section of the executable section:
        executable manage-migrations
          hs-source-dirs:      src
          main-is:             Main.hs
          default-language:    Haskell2010
          build-depends:       base >= 4.7 && < 5
                             , persistent
                             , persistent-template
                             , persistent-sqlite
                             , text
                             , mtl
  1. Open src/Main.hs. We will be adding our source here.

  2. Add the extensions required for invoking Persistent and persistent-template functions:
 {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ...

Get Haskell Cookbook 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.