The serverless-haskell package

[ Tags: aws, cloud, library, mit, network ] [ Propose Tags ]

Utilities to help process the events from AWS Lambda when deployed with the serverless-haskell plugin.

[Skip to Readme]


Versions 0.0.0, 0.0.2, 0.0.3, 0.0.4, 0.0.6, 0.1.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.4.1
Dependencies aeson, aeson-casing, amazonka-core, amazonka-kinesis, amazonka-s3, base (>=4.7 && <5), bytestring, lens, text, time, unix, unordered-containers [details]
License MIT
Category AWS, Cloud, Network
Home page
Bug tracker
Source repo head: git clone
Uploaded Fri Feb 23 02:58:18 UTC 2018 by AlexeyKotlyarov
Distributions NixOS:0.4.0, Stackage:0.4.1
Downloads 527 total (127 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-02-23 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for serverless-haskell-0.4.1

[back to package description]

Serverless Haskell

Build status Hackage Hackage dependencies npm

Deploying Haskell code onto AWS Lambda using Serverless.



  • Create a Stack package for your code:

    stack new mypackage

    LTS 9 and 10 are supported, older versions are likely to work too but untested.

  • Initialise a Serverless project inside the Stack package directory and install the serverless-haskell plugin:

    cd mypackage
    npm init .
    npm install --save serverless serverless-haskell
  • Create serverless.yml with the following contents:

      name: aws
      runtime: nodejs6.10
        handler: mypackage.myfunc
        # Here, mypackage is the Haskell package name and myfunc is the executable
        # name as defined in the Cabal file
      - serverless-haskell
  • Write your main function:

    import qualified Data.Aeson as Aeson
    import AWSLambda
    main = lambdaMain handler
    handler :: Aeson.Value -> IO [Int]
    handler evt = do
      putStrLn "This should go to logs"
      print evt
      pure [1, 2, 3]
  • Use sls deploy to deploy the executable to AWS Lambda. Note: sls deploy function is not supported.

    The serverless-haskell plugin will build the package using Stack and upload it to AWS together with a JavaScript wrapper to pass the input and output from/to AWS Lambda.

    You can test the function and see the invocation results with sls invoke myfunc.


  • sls deploy function is not supported.
  • Only AWS Lambda is supported at the moment. Other cloud providers would require different JavaScript wrappers to be implemented.

See AWSLambda for documentation, including additional options to control the deployment.


  • Haskell code is tested with Stack: stack test.
  • JavaScript code is linted with eslint.

Integration tests

Integration tests are not run automatically due to the need for an AWS account. To run them manually:

  • Ensure you have the required dependencies: curl, jq, NPM, pwgen and Stack.
  • Get an AWS account and add the access credentials into your shell environment.
  • Run ./integration-test/ The exit code indicates success.


  • Run the integration tests.
  • Install bumpversion: pip install bumpversion.
  • Run bumpversion major|minor|patch.
  • Run git push --tags && git push.