Getting Started

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 | sh

Haskell compiles to native code, which is super efficient. But it has one main drawback: linking changes from machine to machine.

To make sure that our projects always work and are reproducible, we use the Stack feature for Docker support to build our projects. Be sure to install Docker before getting started with the runtime 😄

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 --resolver=lts-15.16 --omit-packages

This will create a my-haskell-lambda directory with the following structure:

├── Makefile
├── Setup.hs
├── app
│   └── Main.hs
├── my-haskell-lambda.cabal
├── package.yaml
├── src
│   └── Lib.hs
└── stack.yaml

Now, add the following to your stack.yaml file:

- .

- 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,

to the stack.yaml file:

- aws-lambda-haskell-runtime-3.0.0

and, to the package.yaml file:

- ... # other dependencies of your project
- aws-lambda-haskell-runtime >= 3.0.0

Keep reading!

If you have completed these steps, and type into your terminal:

stack build

you should get a proper build of your project.

Let's see how we can add our first handler!