I want to traverse a String in the following way:
import cats.implicits._
object RnaTranscription {
val mMap: Map[Char, Option[Char]] =
Map('G' -> Some('C'),
'C' -> Some('G'),
'T' -> Some('A'),
'A' -> Some('U')).withDefaultValue(None)
def toRna(dna: String): Option[String] = {
dna.toList.traverse(mMap).map(_.mkString)
}
}
But it has extra steps, I need to cast to a List[Char] and then mkString again, is there a way in cats or scalaz to traverse a String without casting to list?