A singleton stream
>>> stdoutLn $ yield "hello"
hello
>>> S.sum $ do {yield 1; yield 2; yield 3}
6 :> ()
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulelinear-base-0.4.0Haskell2010
This module provides all functions which produce a 'Stream (Of a) m r' from some given non-stream inputs.
StreamsA singleton stream
>>> stdoutLn $ yield "hello"
hello
>>> S.sum $ do {yield 1; yield 2; yield 3}
6 :> ()
Stream the elements of a pure, foldable container.
>>> S.print $ each' [1..3]
1
2
3
Build a Stream by unfolding steps starting from a seed. In particular note
that S.unfoldr S.next = id.
Read the lines of a file given the filename.
Repeat an element several times.
Repeat an action several times, streaming its results.
>>> import qualified Unsafe.Linear as Unsafe
>>> import qualified Data.Time as Time
>>> let getCurrentTime = fromSystemIO (Unsafe.coerce Time.getCurrentTime)
>>> S.print $ S.replicateM 2 getCurrentTime
2015-08-18 00:57:36.124508 UTC
2015-08-18 00:57:36.124785 UTC
Replicate a constant element and zip it with the finite stream which is the first argument.
StreamsstdinLnN n is a stream of n lines from standard input
Provides a stream of standard input and omits the first line that satisfies the predicate
Provides a stream of standard input and omits the first line that satisfies the predicate, possibly requiring IO
Given a finite stream, provide a stream of lines of standard input zipped with that finite stream
Iterate a pure function from a seed value, streaming the results forever.
Iterate a monadic function from a seed value, streaming the results forever.
Cycle a stream a finite number of times
cycleZip s1 s2 will cycle s2 just enough to zip with the given finite
stream s1. Note that we consume all the effects of the remainder of the
cycled stream s2. That is, we consume s2 the smallest natural number of
times we need to zip.
Like enumFromThenN but where the next element in the enumeration is just
the successor succ n for a given enum n.
Like enumFromThenZip but where the next element in the enumeration is just
the successor succ n for a given enum n.
An finite sequence of enumerable values at a fixed distance, determined by the first and second values.
>>> S.print $ S.enumFromThenN 3 100 200
100
200
300
A finite sequence of enumerable values at a fixed distance determined by the first and second values. The length is limited by zipping with a given finite stream, i.e., the first argument.