Skip to content

Instantly share code, notes, and snippets.

@zhengbli
Last active December 8, 2019 04:34
Show Gist options
  • Save zhengbli/b182c4cf52f494aea7df03b89d692899 to your computer and use it in GitHub Desktop.
Save zhengbli/b182c4cf52f494aea7df03b89d692899 to your computer and use it in GitHub Desktop.
Either<TSuccess1, TError> DoWork1() { ... }
TSuccess2 Transform(TSuccess1 successValue1) { ... }
Either<TSuccessFinal, TError> DoWork2(TSuccess2 successValue1) { ... }
var result = DoWork1()
.Map(Transform)
.FlatMap(DoWork2)
// "DoOther" is another helper operator we added that handles the "Left" case
// and return the value as is after it's done.
.DoOther(ErrorHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment