RowDecoderF

fs2.data.csv.RowDecoderF
See theRowDecoderF companion object
@FunctionalInterface
trait RowDecoderF[H <: (Option), T, Header]

Describes how a row can be decoded to the given type.

RowDecoderF provides convenient methods such as map, emap, or flatMap to build new decoders out of more basic one.

Actually, RowDecoderF has a cats MonadError instance. To get the full power of it, import cats.syntax.all._.

Attributes

Companion
object
Source
RowDecoderF.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def apply(row: RowF[H, Header]): DecoderResult[T]

Attributes

Source
RowDecoderF.scala

Concrete methods

def either[B](cd: RowDecoderF[H, B, Header]): RowDecoderF[H, Either[T, B], Header]

Similar to or, but return the result as an Either signaling which row decoder succeeded.

Similar to or, but return the result as an Either signaling which row decoder succeeded. Allows for parsing an unrelated type in case of failure.

Type parameters

B

the type the alternative decoder returns

Value parameters

cd

the alternative decoder

Attributes

Returns

a decoder combining both decoders

Source
RowDecoderF.scala
def emap[T2](f: T => DecoderResult[T2]): RowDecoderF[H, T2, Header]

Map the parsed value, potentially failing.

Map the parsed value, potentially failing.

Type parameters

T2

the result type

Value parameters

f

the mapping function

Attributes

Returns

a row decoder reading the mapped type

Source
RowDecoderF.scala
def flatMap[T2](f: T => RowDecoderF[H, T2, Header]): RowDecoderF[H, T2, Header]

Map the parsed value to a new decoder, which in turn will be applied to the parsed value.

Map the parsed value to a new decoder, which in turn will be applied to the parsed value.

Type parameters

T2

the result type

Value parameters

f

the mapping function

Attributes

Returns

a row decoder reading the mapped type

Source
RowDecoderF.scala
def map[T2](f: T => T2): RowDecoderF[H, T2, Header]

Map the parsed value.

Map the parsed value.

Type parameters

T2

the result type

Value parameters

f

the mapping function

Attributes

Returns

a row decoder reading the mapped type

Source
RowDecoderF.scala
def or[TT >: T](cd: => RowDecoderF[H, TT, Header]): RowDecoderF[H, TT, Header]

Fail-over.

Fail-over. If this decoder fails, try the supplied other decoder.

Type parameters

TT

the return type

Value parameters

cd

the fail-over decoder

Attributes

Returns

a decoder combining this and the other decoder

Source
RowDecoderF.scala