streams

Various Haskell 2010 stream comonads

http://github.com/ekmett/streams

Version on this page:3.3.2
LTS Haskell 23.1:3.3.3
Stackage Nightly 2024-12-26:3.3.3
Latest on Hackage:3.3.3

See all snapshots streams appears in

BSD-3-Clause licensed by Edward A. Kmett
Maintained by Edward A. Kmett
This version can be pinned in stack with:streams-3.3.2@sha256:c5115080746c786edd0bf4d01ed7121638731d44479959112c6029b3fcdb559d,4159

Module documentation for 3.3.2

Used by 1 package in nightly-2024-11-11(full list with versions):

Various Haskell 2010 stream comonads. * Data.Stream.Future provides a coinductive anti-causal stream, or non-empty ZipList. The comonad provides access to only the tail of the stream. Like a conventional ZipList, this is not a monad.

data Future a = Last a | a :< Future a
  • Data.Stream.Future.Skew provides a non-empty skew-binary random-access-list with the semantics of Data.Stream.Future. As with Data.Stream.Future this stream is not a Monad, since the Applicative instance zips streams of potentially differing lengths. The random-access-list structure provides a number of operations logarithmic access time, but makes Data.Stream.Future.Skew.cons less productive. Where applicable Data.Stream.Infinite.Skew may be more efficient, due to a lazier and more efficient Applicative instance.

  • Data.Stream.Infinite provides a coinductive infinite anti-causal stream. The Comonad provides access to the tail of the stream and the Applicative zips streams together. Unlike Future, infinite stream form a Monad. The monad diagonalizes the Stream, which is consistent with the behavior of the Applicative, and the view of a Stream as a isomorphic to the reader monad from the natural numbers. Being infinite in length, there is no Alternative instance.

data Stream a = a :< Stream a
  • Data.Stream.Infinite.Skew provides an infinite skew-binary random-access-list with the semantics of Data.Stream.Infinite Since every stream is infinite, the Applicative instance can be considerably less strict than the corresponding instance for Data.Stream.Future.Skew and performs asymptotically better.

  • Data.Stream.Infinite.Functional.Zipper provides a bi-infinite sequence, represented as a pure function with an accumulating parameter added to optimize moving the current focus.

data Zipper a = !Integer :~ (Integer -> a)
  • Data.Stream.Supply provides a comonadic supply of unique values, which are generated impurely as the tree is explored.

Changes

3.3.2 [2023.03.12]

  • Support building with semigroupoids-6.

3.3.1 [2022.11.30]

  • Add Boring and Absurd instances for infinite streams.
  • Add a head :: Stream a -> a function to Data.Stream.Infinite.

3.3

  • Removed a number of redundant parts of the API. If a method you were using has been removed, consider the classes available. No functionality was lost.
  • Better support for GHC 7.10, the Foldable (length, null) members are now defined directly leading to asymptotic improvements and helping to further shrink the API.
  • Added prepend and concat functions to Data.Stream.Infinite
  • Allow comonad-5

3.2.2

  • Bug fix in Data.Stream.Infinite.Skew and removed fromList.

3.2.1

  • Add support for semigroupoids 5 and GHC 7.10

3.2

  • Switched to tabulate and index from adjunctions. Note: this reversed the argument order to index.
  • Proper upper bounds on dependencies.

3.1.1

  • Marked modules appropriately Trustworthy

3.0.1

  • Removed intra-package dependency bounds for my packages
  • Build system improvements
  • IRC Buildbot notification

3.0

  • Version sync with the rest of my packages

0.7

  • “Data.Stream.NonEmpty” renamed to “Data.List.NonEmpty” and pushed upstream into the semigroups package.

0.6.3

  • Removed a redundant UNPACK pragma

0.5.1

  • Data.Stream.Supply added

Since 0.1:

  • A number of strictness issues with ‘NonEmpty’ were fixed
  • More documentation