Created
May 9, 2018 20:12
-
-
Save PanAeon/8d3ef59cf6263acf2db3d78b424c9cc4 to your computer and use it in GitHub Desktop.
Foogen
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
package mydsltry2 | |
import shapeless._ | |
import shapeless.{ HList, ::, HNil } | |
import scala.language.implicitConversions | |
trait UTupler[A] { | |
type Out | |
} | |
object UTupler extends LowPriority { | |
trait Auxilary[A,B,R] { //A::B::R | |
type Out | |
} | |
trait Auxilary2[A,B,R, R1] { //A::B::R | |
type Out | |
} | |
trait Aux[A,R] { | |
type Out | |
} | |
implicit def base0Utuple[A, R <: HList](t:(A,Unit), r:R) | |
(implicit aux: Aux[A,R]): aux.Out = ??? | |
implicit def base1Utuple[A, R <: HList](t:(Unit, A), r:R) | |
(implicit aux: Aux[A,R]): aux.Out = ??? | |
implicit def utuple[A,B, R <: HList](t: (A,B), r: R) | |
(implicit auxilary: Auxilary[A,B,R]): auxilary.Out = ??? | |
// now two way merge | |
implicit def auxilary[A,B,R1 <: HList, R2 <: HList](a:A, b:B, r:R1) | |
(implicit auxA:Aux[A,R2], auxB: Aux[B,R1]) : Auxilary2[A,B,R1, auxB.Out] = | |
new Auxilary2[A,B,R1,auxB.Out] { | |
type Out = auxA.Out | |
} | |
} | |
trait LowPriority { | |
implicit def anyToUTuple[A, R <: HList](a:A, r:R) : A :: R = ??? // aha, yeah | |
} | |
object MyDsl { | |
def convert[A](a:A)(implicit utupler: UTupler[A]): utupler.Out = ??? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment