streams: Various Haskell 2010 stream comonads
Various Haskell 2010 stream comonads.
Data.Stream.Branching provides an "f-Branching Stream" comonad, aka the cofree comonad, or generalized rose tree.
data Stream f a = a :< f (Stream a)
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 conventionalZipList, 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 aMonad, since theApplicativeinstance zips streams of potentially differing lengths. The random-access-list structure provides a number of operations logarithmic access time, but makesData.Stream.Future.Skew.consless productive. Where applicable Data.Stream.Infinite.Skew may be more efficient, due to a lazier and more efficientApplicativeinstance.
Data.Stream.NonEmpty provides a non-empty list comonad where the Applicative and Monad work like those of the
[a]. Being non-empty, it trades in theAlternativeandMonoidinstances of[a]for weaker append-basedFunctorAltandSemigroupinstances while becoming a member ofComonadandComonadApply. Acting like a list, the semantics of<*>and<.>take a cross-product of membership from bothNonEmptylists rather than zipping like aFuture
data NonEmpty a = a :| [a]
Data.Stream.Infinite provides a coinductive infinite anti-causal stream. The
Comonadprovides access to the tail of the stream and theApplicativezips streams together. UnlikeFuture, infinite stream form aMonad. The monad diagonalizes theStream, which is consistent with the behavior of theApplicative, and the view of aStreamas a isomorphic to the reader monad from the natural numbers. Being infinite in length, there is noAlternativeinstance, but instead theFunctorAltinstance provides access to theSemigroupof interleaving streams.
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
Applicativeinstance 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)
Changes since 0.1:
A number of strictness issues with
NonEmptywere fixedMore documentation
[Skip to Readme]
Modules
- Data
- Stream
- Data.Stream.Branching
- Data.Stream.Future
- Data.Stream.Future.Skew
- Data.Stream.Infinite
- Functional
- Data.Stream.Infinite.Functional.Zipper
- Data.Stream.Infinite.Skew
- Functional
- Data.Stream.NonEmpty
- Stream
Downloads
- streams-0.3.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.1, 0.2, 0.3, 0.3.1, 0.4, 0.5.0, 0.5.1, 0.5.1.1, 0.5.1.2, 0.6.0, 0.6.0.1, 0.6.1.1, 0.6.1.2, 0.6.3, 0.7.0, 0.7.1, 0.7.2, 0.8.0, 0.8.0.1, 0.8.0.2, 0.8.0.3, 0.8.0.4, 0.8.1, 0.8.2, 3.0, 3.0.0.1, 3.0.1, 3.0.1.1, 3.1, 3.1.1, 3.2, 3.2.1, 3.3, 3.3.1, 3.3.2, 3.3.3 |
|---|---|
| Dependencies | base (>=4 && <4.4), comonad (>=0.6.2.1 && <0.7), functor-apply (>=0.7.4 && <0.8), semigroups (>=0.3.2 && <0.4) [details] |
| License | BSD-3-Clause |
| Copyright | Copyright 2011 Edward Kmett Copyright 2010 Tony Morris, Oliver Taylor, Eelis van der Weegen Copyright 2007-2010 Wouter Swierstra, Bas van Dijk |
| Author | Edward A. Kmett |
| Maintainer | Edward A. Kmett <ekmett@gmail.com> |
| Uploaded | by EdwardKmett at 2011-01-22T21:01:52Z |
| Category | Control, Comonads |
| Home page | http://github.com/ekmett/streams |
| Source repo | head: git clone git://github.com/ekmett/streams.git |
| Distributions | Arch:3.3.3, LTSHaskell:3.3.3, NixOS:3.3.3, Stackage:3.3.3 |
| Reverse Dependencies | 9 direct, 8533 indirect [details] |
| Downloads | 29981 total (83 in the last 30 days) |
| Rating | 2.0 (votes: 1) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs not available [build log] All reported builds failed as of 2016-12-28 [all 6 reports] |