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
monadicオブジェクトが有効値を持っていて、かつ指定された条件を満たした時、にand_thenするようなやつ。
and_then
auto f() -> expected<int, bool>; // こんな雰囲気 harmony::monas(f()) | exists([](int n) { return n == 20;}).then([](int n) { /* 何か処理 */ }); // あるいは harmony::monas(f()) | exists_then([](int n) { return n == 20;}, [](int n) { /* 何か処理 */ }); // and_thenでやろうとするとこうなる harmony::monas(f()) | and_then( [](int n) { if (n == 20) { /* 何か処理 */ } else { return n; } });
双対的にor_else版も必要。
or_else
求む適切な名前。
The text was updated successfully, but these errors were encountered:
候補1 when().and_then(), when().or_else()
harmony::monas(f()) | when([](int n) { return n == 20;}).and_then([](int n) { /* 何か処理 */ }); harmony::monas(f()) | when([](int n) { return n == 20;}).or_else([](int n) { /* 何か処理 */ });
Sorry, something went wrong.
harmony::monas(f()) | when([](int n) { return n == 20;}) | and_then([](int n) { /* 何か処理 */ });
の方が自然?
とするとfilterとかにした方がいい?
filter
harmony::monas(f()) | filter([](int n) { return n == 20;}) | and_then([](int n) { /* 何か処理 */ });
No branches or pull requests
monadicオブジェクトが有効値を持っていて、かつ指定された条件を満たした時、に
and_then
するようなやつ。双対的に
or_else
版も必要。求む適切な名前。
The text was updated successfully, but these errors were encountered: