Skip to content

Releases: typelevel/fs2

v2.5.7

01 Jul 13:12
f51e5bd
Compare
Choose a tag to compare

Supports Cats Effect 2 and built for Scala 2.12, 2.13, and 3 final.

Fixes:

  • Fixes thread handling gotcha when using readOutputStream (#2037 #2383 #2446) (fixed by @vasilmkd and back ported from 3.0 by @bpholt)
  • Various build cleanup and warning cleanup

Acknowledgments

➜  git shortlog -sn --no-merges "v2.5.6".."v2.5.7"
    10  Vasil Vasilev

v3.0.4

21 May 00:36
ac50b2f
Compare
Choose a tag to compare

Supports Cats Effect 3 and built for Scala 2.12, 2.13, and 3 final.

Fixes:

  • Fixed memory leak in Channel which also impacted merge and other concurrent combinators (#2408)

Acknowledgments

➜  git shortlog -sn --no-merges "v3.0.3".."v3.0.4"
     2  Scala Steward
     1  Diego E. Alonso Blas
     1  Jens Halm
     1  Juraj
     1  Michael Pilquist
     1  Rehan Mahmood
     1  nikiforo

v3.0.3

14 May 12:42
c54815f
Compare
Choose a tag to compare

Supports Cats Effect 3 and built for Scala 2.12, 2.13, and 3 final.

Fixes:

  • Fixed memory leak in Stream#map (#2394)
  • Fixed bug in file watching support when watching multiple files in same directory (#2375)
  • Fixed bug in fixedRate and derived operations where dampening was not working (#2386)
  • Fixed ClassCastException in Chunk (#2380)

New Features:

  • Added fs2.io.net.unixsocket package to fs2-io, providing support for working with unix domain sockets. Supports both JEP380 (if running on JDK16+) or JNR (if dependency is added to class path) (#2376)
  • Added Stream#meteredStartImmediately (#2369)
  • Added Pull.loopEither (#2368)

Performance

  • Reimplemented readOutputStream to avoid using JDK Piped{Input/Output}Stream (#2383)

Acknowledgments

➜  git shortlog -sn --no-merges "v3.0.2".."v3.0.3"
    36  Vasil Vasilev
    24  Michael Pilquist
     6  Christopher Davenport
     6  Scala Steward
     2  shogan
     2  Pau Alarcón
     2  nikiforo
     1  Hugo van Rijswijk
     1  Fabio Labella
     1  Diego E. Alonso Blas
     1  Rehan Mahmood

v2.5.6

14 May 12:28
Compare
Choose a tag to compare

FS2 2.5.x release built for Scala 2.12, 2.13, and 3.0 final.

v3.0.2

23 Apr 13:21
Compare
Choose a tag to compare

Built for Scala 2.12, 2.13, and 3.0.0-RC2/RC3.

Fixes:

  • Fixed stack safety of Stream#map (#2354)

Documentation:

  • Clarified proper use of TLS servers and socket connection handling (#2358)

Acknowledgments

➜  git shortlog -sn --no-merges "v3.0.0".."v3.0.2"
     9  Scala Steward
     5  Michael Pilquist
     4  Tim Spence
     1  Ross A. Baker
     1  William Narmontas

v2.5.5

23 Apr 13:17
Compare
Choose a tag to compare

Same as 2.5.4 but includes support for Scala 3.0.0-RC3

v3.0.0

29 Mar 14:05
Compare
Choose a tag to compare

FS2 3.0.0 is the first official release built for Cats Effect 3, focusing on integration with the new Cats Effect typeclasses and standard library.

Concurrency Support

The biggest API changes to FS2 are in the fs2.concurrent package:

  • The Queue (and InspectableQueue) types are gone in favor of cats.effect.std.Queue (#2201)
  • There's a brand new implementation of Topic which no longer requires an initial element and is significantly faster. (#2252)
  • There's a Channel type -- a multiple producer, single consumer concurrency primitive (#2326)
  • Support for fanout via broadcast operations has been revamped and simplified (#2312)
  • Support for balanced fanout has been removed, though it may return in a future release (#2340)
  • The experimental PubSub type has been removed
  • There's a new TimedPull API which allows simpler implementations of custom pulls that timeout while awaiting elements (#2062)
  • There's a new implementation of groupWithin which is significantly faster (#2327)

Core Changes

One of the most exciting changes yet least visible changes in FS2 3.0.0 is the new interpreter. Stream compilation and evaluation is now handled by the Pull type thanks primarily to the work of @diesalbla. This new interpreter is much easier to work with than the old FreeC based implementation.

Another notable change to core APIs is that they no longer take Sync constraints. Instead, they take the least powerful type class or capability trait possible. For example, Stream.duration requires a Clock[F] constraint instead of Sync[F].

No More Blocker

The cats.effect.Blocker type was removed in CE 3 -- instead, Sync[F] supports blocking calls via Sync[F].blocking(thunk). As a result, FS2 APIs that took a Blocker have been simplified and in some cases, operations have been combined (e.g., lines & linesAsync have been combined to just lines).

Sinks

The deprecated Sink trait has finally been removed and we now represent sinks via a stream transformation that discards all output values -- Stream[F, O] => Stream[F, Nothing] aka Pipe[F, O, Nothing]. This is different than the old definition of Sink which emitted an undefined number of Unit values -- and as a result of the behavior being undefined, implementations varied widely. Implementations included emitting:

  • 0 unit values
  • 1 unit at termination of the source stream
  • 1 unit per output element from source stream
  • 1 unit per output chunk from source stream
  • etc.

There are a few ergonomic improvements related to the new encoding of sinks:

  • Stream.exec(IO.println(...)) - Stream.exec takes an F[Unit] and returns a Stream[F, Nothing]
  • Stream(1, 2, 3).foreach(IO.println) - The foreach method on Stream takes a O => F[Unit] and returns a Stream[F, Nothing]
  • s.unitary - The unitary method on Stream converts a Stream[F, Nothing] to a Stream[F, Unit] which emits a single unit at termination of s
  • Calling flatMap on a Stream[F, Nothing] no longer compiles, which avoids mistakes that result in unexpected behavior.

Capability Traits

The fs2-io project provides support for working with files and networks, abstracting the Java NIO APIs. The implementations require either Async[F] or Sync[F] depending on whether the underlying NIO API is non-blocking or blocking.

One of the main features of CE3 is the position of the Sync and Async type classes in the hierarchy. As the most powerful type classes, they are now firmly at the bottom of the hierarchy. To avoid requiring Sync / Async constraints in code that uses fs2-io, we are adding capability traits -- traits which limit the capabilities of an effect to a discrete set of operations. The new fs2.io.file.Files[F] capability trait provides the ability to work with files in the effect F. For example:

def readAllText[F[_]: Files](directory: Path): Stream[F, String] =
  Files[F].directoryStream(directory).flatMap { f =>
    Files[F].readAll(f, 1024*1024)
      .through(text.utf8Decode)
      .through(text.lines)
  }

The readAllText method takes a Files[F] capability instead of an Async[F], providing better parametric reasoning.

FS2 ships with some other capability traits:

  • fs2.io.net.Network -- revamped support for TCP, UDP, and TLS, built on Java NIO and ip4s
  • fs2.compression.Compression -- support for deflate and gzip

Stream Compilation

Streams are converted to effects via expressions like s.compile.toList and s.compile.drain. Calling s.compile on a Stream[F, O] requires an implicit Compiler[F, X] (where X is chosen based on the type of compilation requested).

In FS2 2.x, getting a Compiler[F, X] instance for the effect F generally required a Sync[F] (this is not true for the Pure and Fallible effects but is otherwise accurate). In FS2 3, compilation now only requires a Concurrent[F]. If a Concurrent[F] is not available, then compilation falls back to using a Sync[F] -- this allows stream compilation for effects like SyncIO which do not have a Concurrent instance.

In a polymorphic context, compilation is supported by either adding a Concurrent[F] constraint, or if compilation of non-concurrent effects is needed as well, a Compiler.Target constraint:

import fs2.{Compiler, Stream}
import cats.effect.Concurrent

// Allows compilation for any Concurrent[F] but not for things like SyncIO
def compileThis[F[_]: Concurrent, O](f: Stream[F, O]): F[Unit] = f.compile.drain

// Allows compilation for any Concurrent[F] or any Sync[F]
def compileThat[F[_]: Compiler.Target, O](f: Stream[F, O]): F[Unit] = f.compile.drain

Acknowledgements

FS2 3.0.0 has been in the making for over a year and is the work of many individuals. Thanks to everyone who has contributed ideas, discussions, pull requests, etc.

➜  git shortlog -sn --no-merges "v2.5.3".."v3.0.0"
   375  Fabio Labella
   135  Michael Pilquist
   114  mpilquist
    50  Diego E. Alonso Blas
    21  Scala Steward
    19  nikiforo
    11  anikiforov
    10  LLCampos
     9  Domas Poliakas
     6  Dmitry Golubets
     5  Diego E. Alonso-Blas
     5  Raas Ahsan
     2  Ben Plommer
     1  Daniel Spiewak
     1  Luís Campos
     1  Niklas Klein
     1  Luis Martinez
     1  Rafał Krzewski
     1  Rob Norris
     1  Robert Marek
     1  Ryan Peters
     1  Lars Hupel
     1  Zach McCoy
     1  agadek
     1  Kirill
     1  Georgi Krastev
     1  Martins Purins

v2.5.3

20 Feb 14:28
Compare
Choose a tag to compare

This release fixes a bug in fs2-io's TLS support which caused read stalls (#2290)

v3.0.0-M8

15 Feb 17:10
7f3d453
Compare
Choose a tag to compare
v3.0.0-M8 Pre-release
Pre-release

FS2 3.0.0-M8 is the latest milestone in the 3.x release series, featuring support for Cats Effect 3.0.0-RC1. Neither binary nor source compatibility with FS2 2.x is provided, though APIs are largely the same and porting should not be a large task.

The primary feature of FS2 3.0 is support for the Cats Effect 3 type class hierarchy. The Cats Effect 3.0.0 release notes provide a great overview of the changes.

If you're coming from FS2 2.x, be sure to check out the release notes for v3.0.0-M1.

The primary changes in this release are:

  • Overhauled fs2-io networking support (#2189 #2209)
  • Add interop with cats.effect.std.Queue (#2201)
  • New Topic API and implementation (#2252)
  • Lots of internal improvements
git shortlog -sn --no-merges "v3.0.0-M7".."v3.0.0-M8"
    41  Michael Pilquist
    27  Fabio Labella
    22  Scala Steward
    18  Diego E. Alonso Blas
    15  nikiforo
    11  LLCampos
     6  Gabriel Volpe
     5  Raas Ahsan
     4  Luís Campos
     3  Mark Tomko
     1  Luis Martinez
     1  Lars Hupel
     1  Ryan Peters
     1  Jarkko Mönkkönen
     1  Zach McCoy
     1  agadek
     1  Akhtiam Sakaev
     1  Georgi Krastev

v3.0.0-M7

21 Dec 21:57
Compare
Choose a tag to compare
v3.0.0-M7 Pre-release
Pre-release

FS2 3.0.0-M7 is the fifth milestone in the 3.x release series, featuring support for Cats Effect 3. Like Cats Effect 3, we expect a number of milestone releases before a 3.0.0 final release. Neither binary nor source compatibility with FS2 2.x is provided, though APIs are largely the same and porting should not be a large task.

The primary feature of FS2 3.0 is support for the Cats Effect 3 type class hierarchy. The Cats Effect 3.0.0-Mx release notes provide a great overview of the changes.

If you're coming from FS2 2.x, be sure to check out the release notes for v3.0.0-M1.

The primary changes in this release are:

  • Support for Scala 3.0.0-M3
  • Simplified Chunk (#2181)
  • Removed fs2.io.file.SyncFiles
git shortlog -sn --no-merges "v3.0.0-M6".."v3.0.0-M7"
    33  Michael Pilquist
     8  anikiforov
     7  Diego E. Alonso Blas
     4  Scala Steward
     1  Rob Norris