How does the A
turn to be Nothing
in the process?
def seq2map[A](src: Seq[A]): Map[A, A] = {
def pair = for {
f <- src.headOption
s <- src.headOption
} yield (f, s)
Stream continually pair takeWhile(_ isDefined) toMap
}
error: Expression of type Map[Nothing, Nothing]
doesn't conform to expected type Map[A, A]
Thank you!