This guide assumes that you have the Stack build tool installed. If not, you can do so by issuing the following command on your terminal:
curl -sSL https://get.haskellstack.org/ | sh
Haskell compiles to native code, which is super efficient. But it has one main drawback: linking changes from machine to machine.
Using the template
If you are testing the package, or you are starting a new project, we have provided a Stack template that will scaffold the project for you. To use it, enter the following command:
stack new my-haskell-lambda https://github.com/theam/aws-lambda-haskell-runtime/raw/master/stack-template.hsfiles --resolver=lts-15.16 --omit-packages
This will create a
my-haskell-lambda directory with the following structure:
. ├── LICENSE ├── Makefile ├── README.md ├── Setup.hs ├── app │ └── Main.hs ├── my-haskell-lambda.cabal ├── package.yaml ├── src │ └── Lib.hs └── stack.yaml
Now, add the following to your
packages: - . extra-deps: - aws-lambda-haskell-runtime-3.0.0
Adding the dependency to an existing project
If you currently have a project, you can add this package by adding,
extra-deps: - aws-lambda-haskell-runtime-3.0.0
and, to the
dependencies: - ... # other dependencies of your project - aws-lambda-haskell-runtime >= 3.0.0
If you have completed these steps, and type into your terminal:
you should get a proper build of your project.
Let's see how we can add our first handler!