How to do it...

  1. Create a new project, form-handling-in-snap, with the simple stack template:
        stack --resolver lts-9.1 new form-handling-in-snap simple
  1. Add a dependency on the following libraries in the build-depends subsection of the executable section, as follows:
   executable form-handling-in-snap
    hs-source-dirs:      src
    main-is:             Main.hs
    default-language:    Haskell2010
    build-depends:       base >= 4.7 && < 5
                       , snap-server
                       , snap-core
                       , snap
                       , lens
                       , bytestring
                       , text
                       , containers

Once the dependency is added, solve the dependency constraints by using the same resolver and allowing stack to update the stack.yaml file:

      stack --resolver lts-9.1 solver --update-config
  1. Open src/Main.hs. We will add our source here. After the Main module header, add ...

Get Haskell Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.