Skip to content

Instantly share code, notes, and snippets.

@SzymonPobiega
Created May 3, 2011 13:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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);
}
@pjvds
Copy link

pjvds commented May 4, 2011

Looks interesting, was this just an example or is it a piece from running code?

@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