1 package io.circe
2 
3 import cats.syntax.either._
4 
5 trait ValidatingDecoder[A] extends Decoder[A] {
6   override def apply(cursor: HCursor): Decoder.Result[A] =
7     decodeValidating(cursor).toEither.leftMap(_.head)
8 
9   override def decodeAccumulating(
10       cursor: HCursor
11   ): Decoder.AccumulatingResult[A] =
12     decodeValidating(cursor)
13 
14   def decodeValidating(cursor: HCursor): Decoder.AccumulatingResult[A]
15 }
16 
17 object ValidatingDecoder {
18   def instance[A](
19       f: HCursor => Decoder.AccumulatingResult[A]
20   ): ValidatingDecoder[A] =
21     new ValidatingDecoder[A] {
22       override def decodeValidating(
23           cursor: HCursor
24       ): Decoder.AccumulatingResult[A] = f(cursor)
25     }
26 }
Line Stmt Id Pos Tree Symbol Code
7 9 158 - 191 Select cats.data.Validated.toEither ValidatingDecoder.this.decodeValidating(cursor).toEither
7 3 200 - 206 Select cats.data.NonEmptyList.head x$1.head
7 12 158 - 207 Apply cats.syntax.EitherOps.leftMap cats.syntax.`package`.either.catsSyntaxEither[cats.data.NonEmptyList[io.circe.DecodingFailure], A](ValidatingDecoder.this.decodeValidating(cursor).toEither).leftMap[io.circe.DecodingFailure](((x$1: cats.data.NonEmptyList[io.circe.DecodingFailure]) => x$1.head))
12 6 307 - 331 Apply io.circe.ValidatingDecoder.decodeValidating ValidatingDecoder.this.decodeValidating(cursor)
21 15 535 - 538 Apply io.circe.ValidatingDecoder.$anon.<init> new $anon()
24 4 666 - 675 Apply scala.Function1.apply f.apply(cursor)