feral icon indicating copy to clipboard operation
feral copied to clipboard

Should the return type of init really be a Resource?

Open cb372 opened this issue 3 years ago • 1 comments

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.

cb372 avatar Dec 20 '22 12:12 cb372

Or, we can fix it 😂 see

  • https://github.com/typelevel/feral/issues/135

armanbilge avatar Dec 20 '22 13:12 armanbilge