Name: haskell-aws-lambda-kleisli
Owner: Futurice
Description: Run Haskell on AWS Lambda
Created: 2018-04-23 10:55:00.0
Updated: 2018-04-29 06:57:33.0
Pushed: 2018-04-27 09:36:26.0
Homepage: null
Size: 191
Language: Haskell
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
AWS Lambda functions aren't pure ones.
On Linux
will create an uploadable Kleisli.zip
with a simple AWS lambda function.
This is a “boilerplate” to lift handler :: (String -> IO ()) -> Value -> IO Value
into AWS Lambda execution context! (first argument is a logging function).
There three layers:
Kleisli.py
)kleisli_native.c
)src/Kleisli.hs
)Makefile
ties all that together.
foreign-library
Going through Python
and using shared object seems to be much cleaner
approach than spawning a child process.
apt install python-dev
)Some paths are hardcoded, grep for 2.7 and 8.2.2.
The resulting Zip file is 14M large (50M is the maximum package size, see Limits), it's using lens
.
AWS Lambda environment seems to hook print
somehow to enable logging. Printing to stdout
(e.g. print
, putStrLn
etc.) doesn't put anything into logs. Therefore there is a small “workaround”: we pass Python's print
as an argument to Haskell's handler.
Using ctypes
to load Haskell dynamic library could also work. Not sure how to make logging work then though. See e.g. Building AWS Lambda function in Rust for an example.