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 to do it...

  1. Create a new project called using-esqueleto with a simple stack template:
        stack new using-esqueleto simple
  1. Add dependencies on the persistentpersistent-templatepersistent-sqlitetext, and mtl libraries in the build-depends sub-section of the executable section. Also add esqueleto to the same sub-section:
 executable using-esqueleto
   hs-source-dirs:      src
   main-is:             Main.hs
   default-language:    Haskell2010
   build-depends:       base >= 4.7 && < 5
                       , persistent
                       , persistent-template
                       , persistent-sqlite
                       , text
                       , mtl
                       , esqueleto
  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 ...

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