On 06/24/13 22:55, David Sankel wrote:
On Mon, Jun 24, 2013 at 1:19 PM, Eric Niebler
wrote: On 13-06-24 11:53 AM, Pierre Talbot wrote:
This misses what is, IMO, the most important use case of Haskell's Either monad: automatic error propagation. This would be more useful if there were a way to call a function such that if any of the function's arguments were an Either-in-error, the function would immediately return the error.
I implemented something like this. Check out substitution_failure and try_call starting here:
https://github.com/ericniebler/proto-0x/blob/master/boost/proto/v5/utility.h...
In the Expected proposal, there are some methods related to this idea.
<snip various do-syntax derivatives>
If we really care about adding a do syntax EDSL, why not make it general purpose like Haskell's version so that it can work with any monad and compose better with other things?
either
result = do( set( _x, getInt ), set( _y, getInt ), doReturn( pure( _x + _y ) ) ); If we're going to do that, lets do it generically and completely.
+1 David, is there source code demonstrating this do syntax? Could you show how to do Eric's example with this do syntax? -regards, Larry