harmony icon indicating copy to clipboard operation
harmony copied to clipboard

C++ Monadologie

Results 6 harmony issues
Sort by recently updated
recently updated
newest added

今全部`monas`に包んでから`|`で繋げているけれど - `monas`に包んだ場合は`.`でチェーンできる - そうでない場合でも`|`でチェーンできる のようにするのを検討 その場合、`monas`に対して`|`は必要?(後方互換のためには必要だが

```cpp auto success(int) -> int; auto fail(std::nullptr_t) -> std::error_code; f(std::optional opt) { harmony::monas(opt) | match(success, fail) | match(success, [](std::error_code ec){ ... } ); } ``` みたいな。便利かもしれない?

enhancement

各種操作において、呼び出した処理が`void`を返す場合に対応したい。 ```cpp monas(std::optional{5}) | and_then([](int n) { std::cout

enhancement

```cpp int n= 0; int* p = &n; harmony::monas(p) | or_else([](auto&&) { return to_either(false); // monasを返す }); ``` この場合に呼び出す処理の戻り値型が`monas`に包まれている可能性を考慮していない。

bug

monadicオブジェクトが有効値を持っていて、かつ指定された条件を満たした時、に`and_then`するようなやつ。 ```cpp auto f() -> expected; // こんな雰囲気 harmony::monas(f()) | exists([](int n) { return n == 20;}).then([](int n) { /* 何か処理 */ }); // あるいは harmony::monas(f()) | exists_then([](int n) {...

enhancement

```cpp std::error_code f(); bool g(); int main() { // 1. 通る harmony::invert(f()) | and_then([](auto&&) { return g() ? std::optional{true} : std::nullopt; }); // 2. 通らない harmony::invert(f()) | and_then([](auto&&) { return...

bug