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

Add resultflow module #56

Merged
merged 3 commits into from
Jul 31, 2024
Merged

Add resultflow module #56

merged 3 commits into from
Jul 31, 2024

Conversation

osipxd
Copy link
Collaborator

@osipxd osipxd commented Jul 18, 2024

No description provided.

@osipxd osipxd force-pushed the feautre/result-flow branch 4 times, most recently from b1b9e9f to 2d68279 Compare July 18, 2024 18:37
@osipxd
Copy link
Collaborator Author

osipxd commented Jul 18, 2024

Q: Should we also provide an extension Flow<T>.onEachState(...)?
A: I don't think so, as it could lead to puzzles like this:

resultFlow { repository.fetchData() } // Flow<Result<T>>
    .foldEach(
        onSuccess = ::handleResult,
        onFailure = ::handleError,
    ) // Flow<R>, often Flow<Unit>
    .onEachState { resultState ->
        // Will never be printed as the failure was already handled earlier
        if (resultState.isFailure) println("Error")
    }

@AleksandrTabolin
Copy link

@osipxd aproove

@osipxd osipxd changed the title Add result-state module Add result-flow module Jul 19, 2024
@osipxd osipxd force-pushed the feautre/result-flow branch 2 times, most recently from be0072f to 92a4bbf Compare July 30, 2024 09:36
@osipxd osipxd changed the title Add result-flow module Add resultflow module Jul 30, 2024
@osipxd osipxd marked this pull request as ready for review July 30, 2024 09:37
@osipxd osipxd self-assigned this Jul 30, 2024
@osipxd osipxd merged commit 593e857 into main Jul 31, 2024
2 checks passed
@osipxd osipxd deleted the feautre/result-flow branch July 31, 2024 11:49
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

Successfully merging this pull request may close these issues.

2 participants