theam / aws-lambda-haskell-runtime

⚡Haskell runtime for AWS Lambda
https://theam.github.io/aws-lambda-haskell-runtime/
Other
269 stars 48 forks source link

add custom handlers support? #112

Open stevemao opened 2 years ago

stevemao commented 2 years ago

APIGatewayHandler and ALBHandler are very handy handlers. I'm wondering if we could write more custom handlers using the low level StandaloneLambdaHandler?

Had a quick look at the source code it seems impossible right now. These three handlers are constructers of Handler type. Perhaps Handler should be a typeclass.

NickSeagull commented 2 years ago

Thanks for reporting this!

Now that you mention it, maybe it could be done through ReaderT handler (IO a)? I think it could be positive to use it in a concrete way like that, instead of relying on a type class which could result in more confusing errors for newcomers