Skip to content

Add a done action in the Fold type #543

@harendra-kumar

Description

@harendra-kumar

#531 added exception handling to folds, however it has an issue. The after, finally and bracket functions run the release action on extract. But extract can be called over and over again during a scan. Its not right if we release a resource during extract.

One possible improvement to this would be when we have terminating folds, we can run the release action on Stop. However when the stream ends there is no way to communicate to the fold to do any cleanup. To be able to do that we need a done action in the fold which will always be called by the fold driver when the stream ends. This can help the fold perform any final cleanup.

Also, see the scanlMAfter' combinator introduced by #542 . It also introduces a similar done action for the scan.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions