Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
FS2: Functional Streams for Scala 0.9 Official Release Announcement

Hi all!

After a very lengthy period of development and testing, FS2 (formerly scalaz-stream) version 0.9 is finally out! Here's how to get it.

For this release, the library has undergone a major redesign. Check out the migration guide for more info, and also the shiny new user guide. Going forward, we expect the API of the library will be quite stable and hope it becomes one of the bedrock libraries of the Scala ecosystem. The 0.9 series has already seen production use as well as a huge amount of testing during the development process; we feel very good about recommending people upgrade.

A few highlights that I'm excited about:

  • Much more expressive stream transformation primitives, including support for pushback, prefetching, arbitrary use of asynchronous steps, and the ability to transform any number of streams. This is much more flexible than the previous approach of baking in support for a few fixed 'shapes' like Process1, Tee, and Wye.
  • Chunking now baked into the library along with support for working with unboxed chunks of primitives; most library operations try to preserve chunkiness whenever possible. This is a huge efficiency boost for some use cases.
  • Library no longer reliant on Task and users can bring their own effect types
  • The async package has been generalized to work with any effect type with an Async instance. Added Semaphore, an asynchronous semaphore, used as a concurrency primitive in various places.
  • Library now implemented atop a small set of core primitives; there is only one stream interpreter, about 45 LOC, which does not use casts, rest of library could be implemented in 'userspace'
  • See the migration guide for more

Some other important stuff:

  • The library now has two artifacts, core, and io, each with zero third-party dependencies.
  • There are now separate bindings to both the scalaz and cats libraries, see fs2-scalaz and fs2-cats

Thanks to all our contributors, in particular to Michael Pilquist, who has really taken the lead on getting this release out the door.

Cheers,
Paul :)

PS: Lastly, I just want to mention one more thing that I think is nice about 0.9. Though the main stream type is covariant, we implement a trick to prevent Scala from gleefully inferring a silly upper bound like Any for code that 'should' be a type error. Read all about it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment