2. ...lets imagine that your program its just a data.
Meta programming is about:
META
FLAVOUROFM-PROGRAMMINGWITHSHAPELESS
flatMap
Exposing part of compiler outside
Code generation
Moving to compile time evaluation
10. SHAPELESS
FLAVOUROFM-PROGRAMMINGWITHSHAPELESS
Library that implements heterogeneous list and bunch of macroses for it
// HList[String, HList[Int, HNil]]
implicit def hListT[H, T <: HList]
(implicit headT: Transformer[H],
tailT: Transformer[T]): Transformer[H :: T] = ???
implicit val hNilT = new Transformer[HNil] {
override def transform(a: HNil): Seq[String] = Nil
}
11. SHAPELESS
FLAVOUROFM-PROGRAMMINGWITHSHAPELESS
Library that implements heterogeneous list and bunch of macroses for it
implicitly[Transformer[String :: Int :: Nil]].transform(ourHList)
Search for implicit to convert HList[A, B]
Build HList[String, HList[B, C]]
Search for implicit to convert String
Search for implicit to convert Int and Nil
Provide converter from HList[Int, Nil] to Seq[String]
Provide converter from HList[String, HList[Int, Nil]] to Seq!