3rdparty/eventuals

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

Opened this issue · 0 comments

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.