- Create a new project, file-upload, with a simple stack template:
stack new file-upload simple
- Add a dependency on the snap-core library in the build-depends subsection of the executable section, as follows:
executable file-upload hs-source-dirs: src main-is: Main.hs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , snap-core , snap-server , heist , snap , lens , bytestring , io-streams , text
- Use the following command to solve the constraints within the current resolver. For this recipe, we have used lts-9.1 as a resolver:
stack --resolver lts-9.1 solver --update-config
- Open src/Main.hs. We will add our source here. Enable the GHC extensions OverloadedStrings and TemplateHaskell. After the Main module ...