Comments (9)
Not sure, "catch" really sounds exception-oriented but here it might not be.
from expected.
As we have catch_exception
that is used also to recover from exception, it seems that recover
is to general, and cath_error
is more specific.
from expected.
Maybe but I don't like much the catch_exception as a member so I wouldn't pay too much attention about it.
from expected.
My intention, once we have the monads interface is to remove the definition of the all the functions that can be implemented using the minimal interface. Thus, catch_error, catch_exception, mbind, ... all of them could be removed from the expected interface.
I think that this is the basic idea of splitting Algorithm and Data Structures.
from expected.
Ok, I didn't know you wanted to remove that from the interface. But it's right and it's the spirit of the C++ STL. However I'm afraid we'll lose some conveniences without the chaining. Hopefully a binary operator (such as the previously proposed |>) or a construction similar to the do notation would simplify this a lot. Now that I understand your point, I'm ok with the name.
from expected.
I have defined the operator &()
for mbind
and operator |()
for catch_error
on monads errors. These operators allows to chain as if we used the haskell operators >>=
and 'catch_error'
Concerning the do notation, I have added it to the documentation removing the keyword expect
.
return auto a <- f :
auto b <- g :
a + b;
from expected.
Ok nice, could we extend this to:
auto x = auto a <- f :
auto b <- g :
a + b;
So it could appear outside a return statement.
from expected.
The return statement is not part of the do-expression. This was an example. You could even do the following
auto x = (auto a <- f :
auto b <- g :
a + b)
| recoverHandler;
from expected.
from expected.
Related Issues (20)
- [Monads] fix renaming from vale_category to valued_category HOT 1
- [Monads] xxx_category specializations seems not needed when there is no category deduction. HOT 1
- Add un operator||()/catch_exception HOT 1
- Shouldn't all the unexpected values of expected<E,T> compare equal? HOT 2
- Define a common visitation interface for any, variant<E1, ..., En>, exception_ptr
- Add PossibleValued equal operation.
- [monads] Add a Rebindable type_constructor meta-function
- implement rebind by default depending on type_constructor and apply HOT 1
- possible bug (clang 3.6) HOT 15
- Readme: Expected /has/ been proposed: N4109 (N4015). HOT 1
- Printing the what message of an exception HOT 4
- [GCC] invalid initialization of non-const reference of type 'int&' HOT 5
- MSVC2013: linker error LNK2005 - "only_set_valid" already defined HOT 2
- REQUIRES macro should be in boost namespace HOT 1
- Warnings in unexpected value HOT 1
- Why doesn't `expected<void, E>` have `map` and `catch_error` HOT 2
- Would be nice if we could have an rvalue-specialized `catch_error()` HOT 1
- Why does `error_type` need to be default constructible? HOT 3
- `expected<void, E>` doesn't have an unwrapping overload in `bind`, effectively making `bind` equivalent to map HOT 4
- Shouldn't the default `error_traits::make_error` copy in the argument? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expected.