Skip to content

Commit

Permalink
CanBuildFromDecoder: use helper for map()
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed May 17, 2021
1 parent fa3897c commit 50bf1ec
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ object CanBuildFromDecoder {
s"Map[String, ${classTag.runtimeClass.getName}]"
) {
case Conf.Obj(values) =>
val results = values.map {
case (key, value) => ev.read(value).map(key -> _)
}
ConfError.fromResults(results) match {
case Some(err) => NotOk(err)
case None =>
Ok(results.collect { case Ok(x) => x }.toMap)
}
val factory = Map.canBuildFrom[String, A]
build(values, ev, factory)(_._2, (x, y) => (x._1, y))
}

def list[C[_], A](
Expand Down

0 comments on commit 50bf1ec

Please sign in to comment.