Last active
October 21, 2015 19:37
-
-
Save tomaszperek/994cced1161d826d24a1 to your computer and use it in GitHub Desktop.
Implementation of ScalacApplicativeBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class ScalacApplicativeBuilder[M[_], In <: HList, Out <: HList](values: In)(implicit m: Monad[M]) { | |
def asTuple[T](implicit ev: IsHListOfM[M, In, Out], m: Monad[M], tupler: Tupler.Aux[Out, T]): M[T] = m.map(hsequence(values))(_.tupled) | |
def apply[F, FOut](f: F)(implicit fnEv: FnToProduct.Aux[F, Out => FOut], ev: IsHListOfM[M, In, Out]): M[FOut] = | |
m.map(hsequence(values))(fnEv(f)) | |
def :@:[X, T1](newOne: M[X]) = ScalacApplicativeBuilder[M, M[X] :: In, X :: Out](newOne :: values) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment