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(seq)
b += seq.head
b += seq.last
b.result
}
See: Method taking Seq[T] to return String rather than Seq[Char] for rationale. It works like a charm in the first case but fails to compile in the second:
List("abc", "def") map {firstAndLast(_)}
List("abc", "def") map firstAndLast
Giving:
error: No implicit view available from CC => Seq[A].
List("abc", "def") map firstAndLast
Any idea how to improve this declaration to avoid extra wrapping? Seems like eta-expansion is the problem (?)