Foundations

This chapter covers background information on using sstream including basic usage of the library. There are many examples covering many of the individual functions of the library not aready covered elsewhere by other blogs or talks.

scalaz-stream is a stream library based on haskell's machines. It can be used to process data that is best modeled as a series of operations applied to a series of similar data instances--streaming I/O.

The source for scalaz-stream, abbreviated sstream in these notes, is located at github.

These notes capture basic usage notes helped me learn how to use the library. sstream has a very high level of abstraction which helps describe computations with a highly expressive and compact notation. It employs a streaming I/O model that is different than actors and the standard scala Stream class.

sstream is built on a few foundational concepts such as

  • A stream representation capturing the state of the stream independently of a driver program that transitions the stream from the current state to the next state.

  • A small set of states that allows propagation of data and control information within the state representation.

  • A "pull" model that follows from sstream's state machine approach.

  • Abstracted environments for effectful computations in order to more intentfully manage side-effects in your program.

If you are just learning functional programming and scala, sstream can seem like a complex library to use to use because it is mixing together multiple concepts at one time including stream processing, concurrency, functional programming and state models. These notes are designed to reduce the learning curve and to help me learn.

scalaz-stream was written using design patterns that are typically described using a vocabulary from category theory. We will briefly cover the key concepts in category theory that apply to the usage of scalaz-stream then describe the basic components in scalaz-stream.

Last updated