Method taking implicit CanBuildFrom does not work with eta-expansion?

前端 未结 2 1080
一向
一向 2021-01-13 04:07

I have a following method:

def firstAndLast[CC, A, That](seq: CC)(implicit asSeq: CC => Seq[A], cbf: CanBuildFrom[CC, A, That]): That = {
  val b = cbf(se         


        
2条回答
  •  离开以前
    2021-01-13 04:23

    Not a full answer to your question, but I’ve just noticed that this works:

    List("abc", "def") map firstAndLast[String, Char, String]
    

    It then means that the type inferencer is having trouble determining the right type parameters for firstAndLast, but I wouldn’t know how to fix it…

提交回复
热议问题