-
Hi, here problem reproduction. Scala 3.1.1, "org.virtuslab" %% "scala-yaml" % "0.0.4", import org.virtuslab.yaml.*
object Yamltest extends App {
def toNode(s: String): Either[YamlError, Node] = s.asNode
def toEitherString(e: Either[YamlError, Node]):Either[String,Node] = e match {
case Left(x) => Left(x.msg)
case Right(x) => Right(x)
}
def toAny(e: Either[String, Node]): Either[String, Any] = e.flatMap(_.as[Any])
val yaml = "1"
val possible_node = toNode(yaml)
val possible_node_string_either = toEitherString(possible_node)
val possible_any = toAny(possible_node_string_either)
println(possible_node)
println(possible_any)
} When compile get: no implicit argument of type org.virtuslab.yaml.LoadSettings was found for parameter settings of method as in trait Node |
Beta Was this translation helpful? Give feedback.
Answered by
kpodsiad
Apr 4, 2022
Replies: 1 comment 2 replies
-
You're flatmapping and expecting I wonder if the compiler should have a better message. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
gilcu2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're flatmapping and expecting
Either[String, Any]
butas[T]
returnsEither[YamlError, T]
.e.flatMap(_.as[Any].left.map(_.toString))
should fix this error.I wonder if the compiler should have a better message.