Skip to content

Instantly share code, notes, and snippets.

@SzymonPobiega
Created May 3, 2011 13:10
Show Gist options
  • Save SzymonPobiega/953302 to your computer and use it in GitHub Desktop.
Save SzymonPobiega/953302 to your computer and use it in GitHub Desktop.
Monads in action
protected override ValidationResults OnValidate(PurchaseTransaction purchaseTransaction)
{
return purchaseTransaction
.With(ValidationCheck)
.Unless(IsValidateServiceDown)
.Try(SendMessageToTransecure)
.InCaseOfException(MarkServiceAsDown)
.Return(TheResult, OrFailureCodeInCaseOfFailure);
}
@marcofranssen
Copy link

Really cool... Mention how the implementation of these methods look like. Can you share?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment