Type of Nat in ToSizedHList

29 views
Skip to first unread message

Michael Dedek

unread,
Aug 6, 2016, 7:20:34 AM8/6/16
to Shapeless Dev
Hello,

I have a problem with supplying ToSizedHList to a function based on length of a HList.

Please take a look at my sample:
def fun[HL <: HList, L0 <: Nat](hlist: HL)(implicit
      l0: Length.Aux[HL, L0],
      t: ToSizedHList[List, String, L0#N]) = {
  val list = List("a", "b")
  list.toSizedHList(hlist.length)
}

I get an error:
error: could not find implicit value for parameter ts: shapeless.ops.traversable.ToSizedHList[List,String,n.N]

I've also tried splitting it

def fun1(n: Nat)(implicit t: ToSizedHList[List, String, n.N]) = {
  val list = List("a", "b")
  list.toSizedHList(n)
}

def fun2[HL <: HList](hlist: HL)(implicit
      l: Length[HL]) = {
  fun1(hlist.length)
}


and other various combinations and none of them work and now I'm completely out of ideas. If you could tell me, what I'm doing wrong, I'd be grateful.

Thanks in advance for your help.
Mike
Reply all
Reply to author
Forward
0 new messages