



Synopsis 

data Stream a   head :: Computable a => Stream a > a   tail :: Computable a => Stream a > Stream a   map :: (Computable a, Computable b) => (a > b) > Stream a > Stream b   intersperse :: a > Stream a > Stream a   interleave :: Stream a > Stream a > Stream a   scan :: Computable a => (a > b > a) > a > Stream b > Stream a   mapAccum :: (Computable acc, Computable b) => (acc > a > (acc, b)) > acc > Stream a > Stream b   iterate :: Computable a => (a > a) > a > Stream a   repeat :: Computable a => a > Stream a   unfold :: (Computable a, Computable c) => (c > (a, c)) > c > Stream a   drop :: Data Unsigned32 > Stream a > Stream a   dropWhile :: (t > Data Bool) > Stream t > Stream t   filter :: (a > Data Bool) > Stream a > Stream a   partition :: (a > Data Bool) > Stream a > (Stream a, Stream a)   zip :: Stream a > Stream b > Stream (a, b)   zipWith :: Computable c => (a > b > c) > Stream a > Stream b > Stream c   unzip :: (Computable a, Computable b) => Stream (a, b) > (Stream a, Stream b)   take :: Storable a => Data Int > Stream (Data a) > Data [a]   splitAt :: Storable a => Data Int > Stream (Data a) > (Data [a], Stream (Data a))   cycle :: Computable a => Vector a > Stream a   recurrence :: Storable a => DVector a > ((Int > Data a) > Data a) > Stream (Data a)   recurrenceI :: (Storable a, Storable b) => DVector a > Stream (Data a) > DVector b > ((Data Int > Data a) > (Data Int > Data b) > Data b) > Stream (Data b)   iir :: Data Float > DVector Float > DVector Float > Stream (Data Float) > Stream (Data Float)   fir :: DVector Float > Stream (Data Float) > Stream (Data Float) 


Documentation 


Infinite streams.
 Instances  



Take the first element of a stream



Drop the first element of a stream



'map f str' transforms every element of the stream str using the
function f



'intersperse a str' inserts an a between each element of the stream
str.



Create a new stream by alternating between the elements from
the two input streams



'scan f a str' produces a stream by successively applying f to
each element of the input stream str and the previous element of
the output stream.



Maps a function over a stream using an accumulator.



Iteratively applies a function to a starting element. All the successive
results are used to create a stream.
iterate f a == [a, f a, f (f a), f (f (f a)) ...] 


Repeat an element indefinitely.
repeat a = [a, a, a, ...] 


unfold f acc creates a new stream by successively applying f to
to the accumulator acc.



Drop a number of elements from the front of a stream





dropWhile p str drops element from the stream str as long as the
elements fulfill the predicate p.
'filter p str' removes elements from the stream str if they are false
according to the predicate p



Splits a stream in two according to the predicate function. All
elements which return true go in the first stream, the rest go in the
second.



Pairs together two streams into one.



Pairs together two streams using a function to combine the
corresponding elements.



Given a stream of pairs, split it into two stream.



'take n str' allocates n elements from the stream str into a
core array.



'splitAt n str' allocates n elements from the stream str into a
core array and returns the rest of the stream continuing from
element 'n+1'.



Loops through a vector indefinitely to produce a stream.



A combinator for descibing recurrence equations, or feedback loops.
It uses memory proportional to the input vector
For exaple one can define the fibonacci sequence as follows:
fib = recurrence (vector [0,1]) (\fib > fib 1 + fib 2)
The expressions fib 1 and fib 2 refer to previous elements in the
stream defined one step back and two steps back respectively.



A recurrence combinator with input
The sliding average of a stream can easily be implemented using
recurrenceI.
slidingAvg :: Data Int > Stream (Data Int) > Stream (Data Int)
slidingAvg n str = recurrenceI (replicate n 0) str (vector [])
(\input _ > sum (indexed n input) `quot` n)



An iir filter on streams



A fir filter on streams


Produced by Haddock version 2.6.1 