Skip to content

Instantly share code, notes, and snippets.

@gszeliga
Created March 5, 2015 22:37
Show Gist options
  • Save gszeliga/6694b21b7b39f5599bfb to your computer and use it in GitHub Desktop.
Save gszeliga/6694b21b7b39f5599bfb to your computer and use it in GitHub Desktop.
object SmartBuilderOps
{
implicit val applicative = applicativeBuilder[String]
implicit def toSmartBuilderOps[E,A,B](s: BuildStep[E,A => B])=new SmartBuilderOps(s)
implicit def smartify[E,A,B,C](target: Curryable[A,B,C])(implicit applicative: Applicative[({type f[x] = BuildStep[E, x]})#f]) = toSmartBuilderOps(applicative.unit(target.curried))
implicit def toValidationOps[T](v: T) = new ValidationOps(v)
}
class ValidationOps[T](v: T){
def failure = Failure(List(v))
def success = Continue(v)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment