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

Execute function on right without returning output of function #39

Closed
Prn-Ice opened this issue Jun 20, 2022 · 2 comments
Closed

Execute function on right without returning output of function #39

Prn-Ice opened this issue Jun 20, 2022 · 2 comments

Comments

@Prn-Ice
Copy link

Prn-Ice commented Jun 20, 2022

Hi. Thanks a lot for this package and your articles, they've completely changed the way I build repositories.

The following usecase occurs a lot in my codebase:

  • Make a request with the repository
  • If the request is successful make some followup request
  • The return type of the followup request and its status(success/failure) are unimportant
  • Return the response of the initial request

Take the following snippet from my account_repository for example

@override
  TaskEither<String, MessageResponse> resendVerificationEmail() {
    return TaskEither.tryCatch(
      _accountClient.resendEmail,
      (e, s) => AppHttpClientException.parseException(e),
    );
  }

Say I want to make some other request if resendVerificationEmail was successful but still return the response from resendVerificationEmail, how would I chain both functions?

@SandroMaglione
Copy link
Owner

Hi @Prn-Ice

This is indeed a method that was missing in fpdart. I have added chainFirst for this 👍

Thanks for the suggestion 🙏🏼

@Prn-Ice
Copy link
Author

Prn-Ice commented Jun 27, 2022

Thanks a ton.

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