Skip to content
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

Should the return type of init really be a Resource? #300

Open
cb372 opened this issue Dec 20, 2022 · 1 comment
Open

Should the return type of init really be a Resource? #300

cb372 opened this issue Dec 20, 2022 · 1 comment

Comments

@cb372
Copy link

cb372 commented Dec 20, 2022

I noticed in IOSetup, the finalizer for the Resource is never run (the finalizer returned from allocated is discarded). I think that's a reasonable thing to do, but it makes the typesignature of IOLambda.Simple#init a little disingenuous:

def init: Resource[IO, Init]

The user goes to the trouble of building a Resource, and probably assumes everything will be cleaned up when the Lambda instance is terminated, when in fact the finalizer is dropped on the floor.

Maybe def init: IO[Init] would be less misleading? Or at least a comment explaining that the finalizer won't be run would be helpful.

@armanbilge
Copy link
Member

Or, we can fix it 😂 see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants