Skip to content

Commit

Permalink
Merge pull request #510 from scala-steward/update/fs2-core-3.9.1
Browse files Browse the repository at this point in the history
Update fs2-core, fs2-io to 3.9.1
  • Loading branch information
ybasket authored Sep 10, 2023
2 parents 5b0d310 + 0e73505 commit 387aad8
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import com.typesafe.tools.mima.core._
val scala212 = "2.12.18"
val scala213 = "2.13.11"
val scala3 = "3.3.0"
val fs2Version = "3.8.0"
val fs2Version = "3.9.1"
val circeVersion = "0.14.6"
val circeExtrasVersion = "0.14.2"
val playVersion = "2.10.0-RC7"
Expand Down
12 changes: 6 additions & 6 deletions cbor-json/shared/src/main/scala/fs2/data/cbor/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ package object json {
chunkAcc: ListBuffer[Token])
: Pull[F, Token, (Chunk[CborItem], Int, Stream[F, CborItem], ListBuffer[Token], String)] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
tokenizeTextStrings(hd, 0, tl, acc, chunkAcc)
Expand All @@ -89,7 +89,7 @@ package object json {
chunkAcc: ListBuffer[Token])
: Pull[F, Token, (Chunk[CborItem], Int, Stream[F, CborItem], ListBuffer[Token], String)] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
tokenizeByteStrings(hd, 0, tl, tag, acc, chunkAcc)
Expand All @@ -114,7 +114,7 @@ package object json {
if (count == 0L) {
Pull.pure((chunk, idx, rest, chunkAcc += Token.EndObject))
} else if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
tokenizeMap(hd, 0, tl, tag, count, chunkAcc)
Expand Down Expand Up @@ -165,7 +165,7 @@ package object json {
if (count == 0L) {
Pull.pure((chunk, idx, rest, chunkAcc += Token.EndArray))
} else if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
tokenizeArray(hd, 0, tl, tag, count, chunkAcc)
Expand All @@ -189,7 +189,7 @@ package object json {
tag: Option[Long],
chunkAcc: ListBuffer[Token]): Pull[F, Token, (Chunk[CborItem], Int, Stream[F, CborItem], ListBuffer[Token])] = {
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
tokenizeValue(hd, 0, tl, tag, chunkAcc)
Expand Down Expand Up @@ -275,7 +275,7 @@ package object json {
rest: Stream[F, CborItem],
chunkAcc: ListBuffer[Token]): Pull[F, Token, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
go(hd, 0, tl, chunkAcc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object ValueParser {

private def raise[F[_]](e: CborParsingException, chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Nothing] =
Pull.output(Chunk.seq(chunkAcc.reverse)) >> Pull.raiseError(e)
Pull.output(Chunk.from(chunkAcc.reverse)) >> Pull.raiseError(e)

private def parseArray[F[_]](chunk: Chunk[CborItem],
idx: Int,
Expand All @@ -45,7 +45,7 @@ object ValueParser {
Pull.pure((chunk, idx, rest, chunkAcc, CborValue.Array(acc.result(), false)))
} else {
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseArray(hd, 0, tl, size, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand All @@ -71,7 +71,7 @@ object ValueParser {
chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue]] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseIndefiniteArray(hd, 0, tl, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand Down Expand Up @@ -102,7 +102,7 @@ object ValueParser {
Pull.pure((chunk, idx, rest, chunkAcc, CborValue.Map(acc.result(), false)))
} else {
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseMap(hd, 0, tl, size, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand All @@ -129,7 +129,7 @@ object ValueParser {
chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue]] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseIndefiniteMap(hd, 0, tl, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand Down Expand Up @@ -158,7 +158,7 @@ object ValueParser {
chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue]] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseByteStrings(hd, 0, tl, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand All @@ -185,7 +185,7 @@ object ValueParser {
chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue]] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseTextStrings(hd, 0, tl, acc, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand All @@ -212,7 +212,7 @@ object ValueParser {
chunkAcc: List[CborValue])(implicit
F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue => Pull[F, Nothing, CborValue]]] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseTags(hd, 0, tl, tags, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand Down Expand Up @@ -244,7 +244,7 @@ object ValueParser {
implicit F: RaiseThrowable[F]): Pull[F, CborValue, Result[F, CborValue]] =
parseTags(chunk, idx, rest, Pull.pure, chunkAcc).flatMap { case (chunk, idx, rest, chunkAcc, tags) =>
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => parseValue(hd, 0, tl, Nil)
case None => Pull.raiseError(new CborParsingException("unexpected end of input"))
}
Expand Down Expand Up @@ -317,7 +317,7 @@ object ValueParser {
rest: Stream[F, CborItem],
chunkAcc: List[CborValue]): Pull[F, CborValue, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => go(hd, 0, tl, Nil)
case None => Pull.done
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private[cbor] object ValueSerializer {
rest: Stream[F, CborValue],
acc: List[CborItem]): Pull[F, CborItem, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(acc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(acc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => go(hd, 0, tl, Nil)
case None => Pull.done
}
Expand All @@ -59,20 +59,20 @@ private[cbor] object ValueSerializer {
}
case CborValue.Array(values, indefinite) =>
if (indefinite)
go(Chunk.seq(values), 0, Stream.empty, CborItem.StartIndefiniteArray :: acc) >>
go(Chunk.from(values), 0, Stream.empty, CborItem.StartIndefiniteArray :: acc) >>
go(chunk, idx + 1, rest, List(CborItem.Break))
else
go(Chunk.seq(values), 0, Stream.empty, CborItem.StartArray(values.size.toLong) :: acc) >>
go(Chunk.from(values), 0, Stream.empty, CborItem.StartArray(values.size.toLong) :: acc) >>
go(chunk, idx + 1, rest, Nil)
case CborValue.Map(values, indefinite) =>
if (indefinite)
go(Chunk.iterable(values.flatMap(p => List(p._1, p._2))),
go(Chunk.from(values.flatMap(p => List(p._1, p._2))),
0,
Stream.empty,
CborItem.StartIndefiniteMap :: acc) >>
go(chunk, idx + 1, rest, List(CborItem.Break))
else
go(Chunk.iterable(values.flatMap(p => List(p._1, p._2))),
go(Chunk.from(values.flatMap(p => List(p._1, p._2))),
0,
Stream.empty,
CborItem.StartMap(values.size.toLong) :: acc) >>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private[low] object ItemParser {
cont: (Chunk[Byte], Int, Stream[F, Byte], List[CborItem]) => Pull[F, CborItem, T])(
onEos: => Pull[F, CborItem, T]): Pull[F, CborItem, T] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => ensureChunk(hd, 0, tl, Nil)(cont)(onEos)
case None => onEos
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private[csv] object RowParser {
line: Long,
chunkAcc: VectorBuilder[Row]): Pull[F, Row, Unit] =
if (T.needsPull(context)) {
Pull.output(Chunk.vector(chunkAcc.result())) >> T.pullNext(context).flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> T.pullNext(context).flatMap {
case Some(context) =>
chunkAcc.clear()
rows(context, currentField, tail, state, line, chunkAcc)
Expand Down Expand Up @@ -92,7 +92,7 @@ private[csv] object RowParser {
rows(T.advance(context), currentField, tail, State.ExpectNewLine, line, chunkAcc)
} else {
// this is an error
Pull.output(Chunk.vector(chunkAcc.result())) >> Pull.raiseError[F](
Pull.output(Chunk.from(chunkAcc.result())) >> Pull.raiseError[F](
new CsvException(s"unexpected character '$c'", Some(line)))
}
case State.ExpectNewLine =>
Expand All @@ -107,7 +107,7 @@ private[csv] object RowParser {
chunkAcc += Row(NonEmptyList(field, tail).reverse, Some(line)))
} else {
// this is an error
Pull.output(Chunk.vector(chunkAcc.result())) >> Pull.raiseError[F](
Pull.output(Chunk.from(chunkAcc.result())) >> Pull.raiseError[F](
new CsvException(s"unexpected character '$c'", Some(line)))
}
case State.BeginningOfField =>
Expand Down
4 changes: 2 additions & 2 deletions finite-state/shared/src/main/scala/fs2/data/esp/ESP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ private[data] class ESP[F[_], Guard, InTag, OutTag](init: Int,
TT: Tag2Tag[InTag, OutTag],
G: Evaluator[Guard, Tag[InTag]]): Pull[F, Out, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
transform(hd, 0, tl, env, e, chunkAcc)
case None =>
step(env, e, none).map(squeezeAll(_)).flatMap { case (e, s) =>
e match {
case Expr.Epsilon =>
Pull.output(Chunk.seq(s))
Pull.output(Chunk.from(s))
case _ => Pull.raiseError(new ESPException(s"unexpected end of input $e"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private[json] final class BuilderChunkAccumulator[Json](builder: Builder[Json])
}

override def chunk(): Chunk[Json] =
Chunk.vector(chunkAcc.result())
Chunk.from(chunkAcc.result())

override def flush(): this.type = {
chunkAcc.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private[json] final class TokenChunkAccumulator extends ChunkAccumulator[Token]
}

override def chunk(): Chunk[Token] =
Chunk.vector(chunkAcc.result())
Chunk.from(chunkAcc.result())

override def flush(): this.type = {
chunkAcc.clear()
Expand Down
4 changes: 2 additions & 2 deletions json/src/main/scala/fs2/data/json/internal/ValueParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ private[json] object ValueParser {
s: Stream[F, Token])(implicit F: RaiseThrowable[F], builder: Builder[Json]): Pull[F, Json, Unit] = {
def go(chunk: Chunk[Token], idx: Int, rest: Stream[F, Token], chunkAcc: List[Json]): Pull[F, Json, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.reverse)) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) => go(hd, 0, tl, Nil)
case None => Pull.done
}
} else {
pullValue(chunk, idx, rest)
.handleErrorWith(t => Pull.output(Chunk.seq(chunkAcc.reverse)) >> Pull.raiseError(t))
.handleErrorWith(t => Pull.output(Chunk.from(chunkAcc.reverse)) >> Pull.raiseError(t))
.flatMap {
case Some((chunk, idx, rest, json)) => go(chunk, idx, rest, json :: chunkAcc)
case None => Pull.done
Expand Down
2 changes: 1 addition & 1 deletion json/src/main/scala/fs2/data/json/internal/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package object internals {
private[json] type Result[F[_], Out] = Option[(Chunk[Token], Int, Stream[F, Token], Out)]

private[json] def emitChunk[T](chunkAcc: VectorBuilder[T]) =
Pull.output(Chunk.vector(chunkAcc.result()))
Pull.output(Chunk.from(chunkAcc.result()))

private[json] def skipValue[F[_]](chunk: Chunk[Token],
idx: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object JsonTagger {
def object_(chunk: Chunk[Token], idx: Int, rest: Stream[F, Token], chunkAcc: ListBuffer[TaggedJson])
: Pull[F, TaggedJson, (Chunk[Token], Int, Stream[F, Token], ListBuffer[TaggedJson])] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
object_(hd, 0, tl, chunkAcc)
Expand All @@ -58,15 +58,15 @@ object JsonTagger {
case Token.EndObject =>
Pull.pure((chunk, idx + 1, rest, chunkAcc += TaggedJson.Raw(Token.EndObject)))
case tok =>
Pull.output(Chunk.seq(chunkAcc.result())) >> Pull.raiseError(JsonException(s"unexpected JSON token $tok"))
Pull.output(Chunk.from(chunkAcc.result())) >> Pull.raiseError(JsonException(s"unexpected JSON token $tok"))

}
}

def array_(chunk: Chunk[Token], idx: Int, rest: Stream[F, Token], arrayIdx: Int, chunkAcc: ListBuffer[TaggedJson])
: Pull[F, TaggedJson, (Chunk[Token], Int, Stream[F, Token], ListBuffer[TaggedJson])] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
array_(hd, 0, tl, arrayIdx, chunkAcc)
Expand All @@ -88,7 +88,7 @@ object JsonTagger {
def value_(chunk: Chunk[Token], idx: Int, rest: Stream[F, Token], chunkAcc: ListBuffer[TaggedJson])
: Pull[F, TaggedJson, (Chunk[Token], Int, Stream[F, Token], ListBuffer[TaggedJson])] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
value_(hd, 0, tl, chunkAcc)
Expand All @@ -110,7 +110,7 @@ object JsonTagger {
rest: Stream[F, Token],
chunkAcc: ListBuffer[TaggedJson]): Pull[F, TaggedJson, Unit] =
if (idx >= chunk.size) {
Pull.output(Chunk.seq(chunkAcc.result())) >> rest.pull.uncons.flatMap {
Pull.output(Chunk.from(chunkAcc.result())) >> rest.pull.uncons.flatMap {
case Some((hd, tl)) =>
chunkAcc.clear()
go_(hd, 0, tl, chunkAcc)
Expand Down
2 changes: 1 addition & 1 deletion xml/src/main/scala/fs2/data/xml/internals/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ import scala.collection.immutable.VectorBuilder
package object internals {

private[internals] def emitChunk[T](chunkAcc: Option[VectorBuilder[T]]) =
chunkAcc.fold(Pull.done.covaryOutput[T])(vb => Pull.output(Chunk.vector(vb.result())))
chunkAcc.fold(Pull.done.covaryOutput[T])(vb => Pull.output(Chunk.from(vb.result())))

}

0 comments on commit 387aad8

Please sign in to comment.