-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Lambda
generic in effect type
#33
Conversation
On its face, I think this is a good idea. I almost always write code in an abstract I pulled this in locally and rebased against abstract class IOCloudFormationCustomResourceHandler[Input : Decoder, Output: Encoder]
extends CloudFormationCustomResourceHandler[IO, Input, Output]
with IOFeral to make it a little more ergonomic when implementing the actual Lambda class. |
Yes, I'm all for defining those convenience versions 👍 btw feel free to push your branch here, save me the rebase 😉 |
63c1ee0
to
2beb1f2
Compare
Oops, didn't realize you had merged scalafmt. Fixing |
Sorry! I think we are missing a formatting check from CI so your PR slipped through undetected 😆 |
2beb1f2
to
1078893
Compare
I actually don't like this! :-) Here's my reasoning… As a practical matter, you need to have a concrete effect at some point in order to run things. We see this with The problem with allowing arbitrary |
Thanks for your thoughts! That mostly* makes sense, so I feel like we've messed up the abstraction somehow. For example, with http4s people build their *Mostly, because what I'm trying to understand is: how does your above reasoning apply to |
I was thinking this would be used more to support other runtimes and to keep our specializations (e.g.
Yes, agreed, but the |
Newer ideas in #45. |
Maybe just me, but building all this stuff in terms of straight
IO
was bugging me. This takes a step away from this to make the effect type generic.I started by defining a
trait Feral[F[_]]
which encapsulates:Async[F]
F[Setup]
for aResource[F, Setup]
Dispatcher[F]
The idea here is not so much to provide a "real"
Dispatcher
(i.e. that supervises its fibers) but as a convenience abstraction for the capability to unsafely run effects. Technically this is an abuse, but here we are setting up aResource
that we have no intention of closing, so yolo.Thus we can provide a convenience
IOFeral
that implements theDispatcher[IO]
directly in terms ofIO
's unsafe methods and theIORuntime
.From here it is straightforward to make everything else generic in
F
.IOLambda
becomes justLambda
, andIOLambda
is provided as a convenience mix-in.Looking forward to thoughts on this.