diff --git a/cookbooks/jq/index.html b/cookbooks/jq/index.html index 713cf42f..fc6d3aa9 100644 --- a/cookbooks/jq/index.html +++ b/cookbooks/jq/index.html @@ -256,7 +256,7 @@

import fs2.data.json.jq.Compiler val queryCompiler = Compiler[IO] -// queryCompiler: Compiler[IO] = fs2.data.json.jq.internal.ESPJqCompiler@6d39cb4d +// queryCompiler: Compiler[IO] = fs2.data.json.jq.internal.ESPJqCompiler@46ad49b4 val queryPipe = queryCompiler.compile(query).unsafeRunSync() // queryPipe: fs2.package.Pipe[IO, json.Token, json.Token] = <function1> diff --git a/documentation/cbor-json/index.html b/documentation/cbor-json/index.html index ee859df9..e7b6e3e1 100644 --- a/documentation/cbor-json/index.html +++ b/documentation/cbor-json/index.html @@ -264,7 +264,7 @@

implicit val stateDecoder = deriveCellDecoder[State] -// stateDecoder: CellDecoder[State] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$coproductDecoder$3@7221ca14 +// stateDecoder: CellDecoder[State] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$coproductDecoder$3@b2f6357 // use stateDecoder to derive decoders for rows...or just test: stateDecoder("On") // res1: DecoderResult[State] = Right(value = On) @@ -199,7 +199,7 @@

// same goes for the encoder implicit val stateEncoder = deriveCellEncoder[State] -// stateEncoder: CellEncoder[State] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$coproductEncoder$3@4793957d +// stateEncoder: CellEncoder[State] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$coproductEncoder$3@2f68cf4b stateEncoder(State.On) // res3: String = "On"

The generic derivation for cell decoders also supports renaming and deriving instances for unary product types (case classes with one field):

@@ -213,9 +213,9 @@

// works as we have an implicit CellDecoder[String] implicit val unknownDecoder = deriveCellDecoder[Advanced.Unknown] -// unknownDecoder: CellDecoder[Advanced.Unknown] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$unaryProductDecoder$3@5d09550a +// unknownDecoder: CellDecoder[Advanced.Unknown] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$unaryProductDecoder$3@70ce4990 implicit val advancedDecoder = deriveCellDecoder[Advanced] -// advancedDecoder: CellDecoder[Advanced] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$coproductDecoder$3@50203307 +// advancedDecoder: CellDecoder[Advanced] = fs2.data.csv.generic.internal.DerivedCellDecoder$$anonfun$coproductDecoder$3@4798a81 advancedDecoder("Active") // res4: DecoderResult[Advanced] = Right(value = On) @@ -223,9 +223,9 @@

// res5: DecoderResult[Advanced] = Right(value = Unknown(name = "Off")) implicit val unknownEncoder = deriveCellEncoder[Advanced.Unknown] -// unknownEncoder: CellEncoder[Advanced.Unknown] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$unaryProductEncoder$3@2cad227d +// unknownEncoder: CellEncoder[Advanced.Unknown] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$unaryProductEncoder$3@743c6482 implicit val advancedEncoder = deriveCellEncoder[Advanced] -// advancedEncoder: CellEncoder[Advanced] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$coproductEncoder$3@774e72e8 +// advancedEncoder: CellEncoder[Advanced] = fs2.data.csv.generic.internal.DerivedCellEncoder$$anonfun$coproductEncoder$3@1d47efd9 advancedEncoder(Advanced.On) // res6: String = "Active" @@ -269,7 +269,7 @@

import fs2.data.csv.generic.semiauto._ implicit val MyRowDecoder: CsvRowDecoder[MyRow, String] = deriveCsvRowDecoder[MyRow] -// MyRowDecoder: CsvRowDecoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowDecoder$$anon$1@56296e6f +// MyRowDecoder: CsvRowDecoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowDecoder$$anon$1@40eafeb3 val decoded = stream.through(decodeUsingHeaders[MyRow]()) // decoded: Stream[[x]Fallible[x], MyRow] = Stream(..) diff --git a/documentation/csv/index.html b/documentation/csv/index.html index 118387e8..f8c2aca5 100644 --- a/documentation/csv/index.html +++ b/documentation/csv/index.html @@ -200,9 +200,9 @@

val textStream = Stream.emit(input).covary[Fallible] // textStream: Stream[Fallible, String] = Stream(..) implicit val myRowDecoder: CsvRowDecoder[MyRow, String] = deriveCsvRowDecoder -// myRowDecoder: CsvRowDecoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowDecoder$$anon$1@43a21a38 +// myRowDecoder: CsvRowDecoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowDecoder$$anon$1@f64ffe3 implicit val myRowEncoder: CsvRowEncoder[MyRow, String] = deriveCsvRowEncoder -// myRowEncoder: CsvRowEncoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowEncoder$$anonfun$productWriter$2@2d03a145 +// myRowEncoder: CsvRowEncoder[MyRow, String] = fs2.data.csv.generic.internal.DerivedCsvRowEncoder$$anonfun$productWriter$2@509730df // decodeUsingHeaders can take a `Char` indicating the separator to use // for example `decodeUsingHeaders[MyRow](';') for a semi-colon separated csv @@ -453,7 +453,7 @@

implicit val parseableMyHeaders: ParseableHeader[MyHeaders] = ParseableHeader.instance[MyHeaders] { name => MyHeaders.withNameInsensitiveOption(name).toRight(new HeaderError(s"Unknown header $name")) } -// parseableMyHeaders: ParseableHeader[MyHeaders] = fs2.data.csv.ParseableHeader$$$Lambda$14212/0x0000000803868c40@35988cf9 +// parseableMyHeaders: ParseableHeader[MyHeaders] = fs2.data.csv.ParseableHeader$$$Lambda$14289/0x0000000803864040@2a8538f4 val withMyHeaders = stream.through(lowlevel.headers[Fallible, MyHeaders]) // withMyHeaders: Stream[[x]Fallible[x], CsvRow[MyHeaders]] = Stream(..) @@ -559,10 +559,10 @@

For CellEncoder, it is even easier to define your own as encoding can't fail, so basically it's just a function A => String. The easiest ways to roll your own are using Scala's single abstract method sugar:

case class Wrapper(content: String)
 implicit val wrapperCellEncoder: CellEncoder[Wrapper] = (w: Wrapper) => w.content
-// wrapperCellEncoder: CellEncoder[Wrapper] = repl.MdocSession$MdocApp$$anonfun$9@663833a8
+// wrapperCellEncoder: CellEncoder[Wrapper] = repl.MdocSession$MdocApp$$anonfun$9@2b641a0

or using contramap on an existing encoder:

implicit val wrapperCellEncoder2: CellEncoder[Wrapper] = CellEncoder[String].contramap(_.content)
-// wrapperCellEncoder2: CellEncoder[Wrapper] = fs2.data.csv.CellEncoder$$anonfun$contramap$2@5681bfa3
+// wrapperCellEncoder2: CellEncoder[Wrapper] = fs2.data.csv.CellEncoder$$anonfun$contramap$2@6b4e88e1

RowDecoder & RowEncoder

RowDecoders can be used to decode an entire CSV row based on field positions. For instance if you want to decode the CSV data into shapeless HList:

diff --git a/documentation/json/jq/index.html b/documentation/json/jq/index.html index b5d86095..c5618031 100644 --- a/documentation/json/jq/index.html +++ b/documentation/json/jq/index.html @@ -325,7 +325,7 @@

val qCompiler = jq.Compiler[SyncIO] -// qCompiler: jq.Compiler[SyncIO] = fs2.data.json.jq.internal.ESPJqCompiler@23fa0796 +// qCompiler: jq.Compiler[SyncIO] = fs2.data.json.jq.internal.ESPJqCompiler@12980847 val compiled = qCompiler.compile(query).unsafeRunSync() // compiled: Pipe[SyncIO, Token, Token] = <function1> diff --git a/documentation/json/jsonpath/index.html b/documentation/json/jsonpath/index.html index c341be5f..9e7e8370 100644 --- a/documentation/json/jsonpath/index.html +++ b/documentation/json/jsonpath/index.html @@ -351,7 +351,6 @@

toList .unsafeRunSync() // res3: List[List[Token]] = List( -// List(StartObject, Key(value = "c"), NumberValue(value = "1"), EndObject), // List( // StartObject, // Key(value = "a"), @@ -364,7 +363,8 @@