I have a simple code
private def convertFieldsNames (fieldsNames: Array[String]): Array[String] =
fieldsNames.map(convertFieldName)
private def convertFieldName (fieldName: String): String = s"!!! $fieldName"
val res = convertFieldsNames(Array("123", "456"))
res.map(println)
it works fine, but when i add type conversions functions, which i'm gonna use in other functions
implicit def fromStringToEitherStringOrArray (str: String): Either[String, Array[String]] = Left(str)
implicit def fromArrayToEitherStringOrArray (arr: Array[String]): Either[String, Array[String]] = Right(arr)
i get an error in a line
fieldsNames.map(convertFieldName)
type mismatch;
found : String => String
required: Array[String] => ?
i expected that these conversions will effect only if conversion to Either value is needed, so i cant get why this error bubbles up in a line where no Either type at all