score:0

Alright, after talking it through with the ever knowledgeable folks on #scala, the following work around was pointed out to me:

trait Axis[A, L1 <: HList] {
  val L2: Mapped[L1,Ordering]
  def vectorize(a:A): L1
  def orderings: L2.Out
}
object Axis {
  def reifiedT[L1 <: HList](implicit M: Mapped[L1,Ordering]): Mapped[L1,Ordering] {
    type Out = M.Out
  } = M
}

implicit object Tup2DI extends Axis[(Double, Int), Double :: Int :: HNil] {
  val L2 = Axis.reifiedT[L]
  def vectorize(a: (Double, Int)) = a._1 :: a._2 :: HNil
  def orderings:L2.Out = implicitly[Ordering[Double]] :: implicitly[Ordering[Int]] :: HNil
}

Apparently you have to tell scala to set the reified Out type explicitly, a technique that's used in the Scalaz library.


Related Query

More Query from same tag