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

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 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 stack.yaml file:

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,

to the stack.yaml file:

extra-deps:
- aws-lambda-haskell-runtime-3.0.0

and, to the package.yaml file:

dependencies:
- ... # 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!