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 IOFeralto 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
IOwas 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 aResourcethat we have no intention of closing, so yolo.Thus we can provide a convenience
IOFeralthat implements theDispatcher[IO]directly in terms ofIO's unsafe methods and theIORuntime.From here it is straightforward to make everything else generic in
F.IOLambdabecomes justLambda, andIOLambdais provided as a convenience mix-in.Looking forward to thoughts on this.