We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem? Please describe. Helper functions to work with Task<Result<'success option, 'error>>
Task<Result<'success option, 'error>>
Example:
type Error = | UsernameTaken | DatabaseError of DbError taskResult { do! // getUserByUsername : string -> Task<Result<User option, DbError>> getUserByUsername createAccountRequest.Username // |> TaskResult.mapError DatabaseError |> TaskResult.bindRequireNone UsernameTaken }
Describe the solution you'd like Helper functions that combine bind + requireSome, requireNone, etc...
bind
requireSome
requireNone
// name needs work :P let inline bindRequireSome (error: 'error) (taskResultOption: Task<Result<'success option, 'error>>) = taskResultOption |> bind (Result.requireSome error >> Task.singleton)
Describe alternatives you've considered N/A
Additional context N/A
I would like to create a PR for this.
The text was updated successfully, but these errors were encountered:
Yeah it seems like the only work around is currently to do it in two binds
let getUserName () = taskResult { return Some "jimmy" } let main () = taskResult { let! userNameOpt = getUserName () let! userName = Result.requireSome "No username" userNameOpt return () }
Seems like a good addition.
Sorry, something went wrong.
sheridanchris
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
Helper functions to work with
Task<Result<'success option, 'error>>
Example:
Describe the solution you'd like
Helper functions that combine
bind
+requireSome
,requireNone
, etc...Describe alternatives you've considered
N/A
Additional context
N/A
I would like to create a PR for this.
The text was updated successfully, but these errors were encountered: