demystifyfp/FsToolkit.ErrorHandling

Can we reinstate `TaskResult.foldResult` and the like?

abelbraaksma opened this issue · 4 comments

Deleting publicly surfaced functions has the big downside that people cannot update their libraries anymore. In this commit (ac33c85) most (but not all, AsyncResult.foldResult still exists) foldResults were removed, apparently because F# Core introduced them? This may be true for Result.fold, but certainly not for the compound types.

Instead, if F# introduced a version of some functionality, if you have a different name, I propose to just alias the F# Core function (if it is already available in the lowest supported F# Core, otherwise just copy its implementation, which I think you've done in the past).

In the case of TaskResult.foldResult , CancellableTask.foldResult and JobResult.foldResult, they just disappeared from FsToolkit, and Result.fold as well. It led (without me knowing) to one team not updating the library anymore as it broke the code (and it was non-trivial to them how to resolve).

To be fair, you kept Result.defaultWith, which existed for similar arguments (see #195, #199).

To reproduce

Upgrade from an older version to a newer and code starts failing to compile.

Expected behavior

More conservative backward compat behavior, if possible (and you know me, I'm willing to help with this! Just ping me)

PS: the documentation still shows that these functions exist: https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling.taskresult/taskresult/foldresult

Yep I agree this removal was short sighted. Send a PR and i'll release it!

Thanks, will do :).

@TheAngryByrd Hi, can you check pr please, these changes are much needed, to upgrade to the current version