Skip to content

Instantly share code, notes, and snippets.

@Jacoby6000
Created April 19, 2015 01:11
Show Gist options
  • Save Jacoby6000/ed0f57709c262694829c to your computer and use it in GitHub Desktop.
Save Jacoby6000/ed0f57709c262694829c to your computer and use it in GitHub Desktop.
def validate(data: T)(onSuccess: T => Either[BadRequest, T]): Either[BadRequest, T] =
validateCreateData(data) match {
case Right(sanitizedData) => onSuccess(sanitizedData)
case fail: Left => fail
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment