Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Serverless Haskell

Serverless Haskell

Slides from a talk on Serverless Haskell at the Melbourne Haskell Users Group meetup, 22nd February 2018

David Overton

February 22, 2018
Tweet

More Decks by David Overton

Other Decks in Programming

Transcript

  1. Motivation • AWS Lambda and the Serverless Framework make it

    easy to write small functions and deploy them to the cloud… • … but not in Haskell • Aim: to make it as easy to do serverless programming in Haskell as it is in NodeJS or Python •
  2. What we did • Serverless Haskell • Developed over a

    3 day Hackathon at SEEK in December 2017 • Consists of ◦ A Serverless plugin ◦ A Haskell library
  3. Serverless plugin • Provides a NodeJS wrapper that spawns your

    Haskell executable • Hooks up pipes for input, output and logging • At the moment it will spawn a new exe on each invocation • Future plan: keep the exe running so that it can handle multiple invocations
  4. Haskell library lambdaMain :: (Aeson.FromJSON event, Aeson.ToJSON res) => (event

    -> IO res) -- ^ Function to process the event -> IO ()
  5. Event types Types for dealing with common Lambda events So

    far • SNS • S3 • Kinesis • APIGateway Plan to add more.
  6. Embedded events • Some event types (e.g. SNS, APIGateway) have

    stringified JSON or Base64 embedded within string values in the JSON • TextValue and Embedded
  7. Conclusion • We have several Lambdas at SEEK using this

    • GitHub https://github.com/seek-oss/serverless-haskell • Also on npm, hackage and stackage • Future extensions: ◦ Allow more than one Lambda invocation ◦ Allow multiple functions per project ◦ Expand the supported event types • We would love to get more users • Pull requests invited