Skip to content
Discussion options

You must be logged in to vote

FYI, final impls, after greater study / insight: ;)

auto tap(auto&& f)
{
    return let_value(
        [f = std::forward<decltype(f)>(f)](auto&&... result) mutable
        { return sequence(f(result...), just(result...)); });
}

auto tap_error(auto&& f)
{
    return let_error([f = std::forward<decltype(f)>(f)](auto error) mutable
                     { return sequence(f(error), just_error(error)); });
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jessmorecroft
Comment options

@jessmorecroft
Comment options

Answer selected by jessmorecroft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant