A type class that defines how to parse an instance of A
to an instance of B
.
Can be thought of as a A => F[IorNec[E, B]]
function.
Attributes
- Companion:
- object
- Graph
- Supertypes
Members list
Value members
Concrete methods
Contravariant map without path changes. Example:
Contravariant map without path changes. Example:
scala> case class User(age: Int)
scala> val user = User(1)
scala> val parser = dupin.basic.BasicParser.idFailure[Int](c => s"${c.path} is wrong")
scala> parser.comap[User](_.age).parse(user)
res0: cats.Id[cats.data.IorNec[String,Int]] = Left(Chain(. is wrong))
scala> parser.comapP[User](_.age).parse(user)
res1: cats.Id[cats.data.IorNec[String,Int]] = Left(Chain(.age is wrong))
Attributes
Contravariant map with explicit path prefix.
Contravariant map with explicit path prefix.
Attributes
Lifts parser to G[_]
type using Traverse
instance, adds index as path prefix,
combines each individual parser result using MonoidK
instance, therefore allows to skip failures.
Lifts parser to G[_]
type using Traverse
instance, adds index as path prefix,
combines each individual parser result using MonoidK
instance, therefore allows to skip failures.
Attributes
- See also:
Lifts parser to G[_]
type using Traverse
instance, adds index as path prefix.
Example:
Lifts parser to G[_]
type using Traverse
instance, adds index as path prefix.
Example:
scala> case class Name(value: String)
scala> val rawNames = List("", "Doe")
scala> val parser = dupin.basic.BasicParser.root[String, Name](
Option(_).filterNot(_.isEmpty).map(Name.apply),
c => s"${c.path} is not a name",
)
scala> parser.liftToTraverseP[List].parse(rawNames)
res0: cats.Id[cats.data.IorNec[String,List[Name]]] = Left(Chain(.[0] is not a name))
scala> parser.liftToTraverseCombiningP[List].parse(rawNames)
res1: cats.Id[cats.data.IorNec[String,List[Name]]] = Both(Chain(.[0] is not a name),List(Name(Doe)))
Attributes
Inherited methods
Contravariant map with macros generated path prefix.
Contravariant map with macros generated path prefix.
Attributes
- See also:
[comap]
- Inherited from:
- ParserBinCompat