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

TypeCheck doesn't correctly handle eventuals::expected as the return type in a wrapped lambda #593

Open
stephaniepalocz opened this issue Jun 12, 2023 · 0 comments

Comments

@stephaniepalocz
Copy link
Contributor

I've written the following (slightly simplified for brevity) code:

v1alpha1::LoadRequest request;
return CallUnary<v1alpha1::LoadRequest, v1alpha1::LoadResponse>(
             "Load",
             std::move(request))
      >> ::eventuals::Then(
             [](v1alpha1::LoadResponse&& response)
                 -> eventuals::expected<std::optional<std::string>> {
               if (response.actors_size() > 1) {
                 return eventuals::make_unexpected("Too many actors");
               }

               if (response.actors_size() == 0) {
                 return std::optional<std::string>();
               }

               return std::move(response.actors(0).state());
             });

I'd like to be able to wrap this code in a TypeCheck:

return ::eventuals::TypeCheck<eventuals::expected<std::optional<std::string>>>(
      CallUnary<v1alpha1::LoadRequest, v1alpha1::LoadResponse>(
          [...]
    )

But unfortunately, the TypeCheck doesn't accept eventuals::expected<std::optional<std::string>> or std::optional<std::string> as correctly matching the lambda function signature in the Then block above.

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

1 participant