Safe Haskell | None |
---|---|
Language | Haskell2010 |
Programming with streams.
Synopsis
- map :: Box (a -> b) -> Str a -> Str b
- hd :: Str a -> a
- tl :: Str a -> O (Str a)
- const :: Stable a => a -> Str a
- constBox :: Box a -> Str a
- shift :: Stable a => a -> Str a -> Str a
- shiftMany :: Stable a => List a -> Str a -> Str a
- scan :: Stable b => Box (b -> a -> b) -> b -> Str a -> Str b
- scanMap :: Stable b => Box (b -> a -> b) -> Box (b -> c) -> b -> Str a -> Str c
- scanMap2 :: Stable b => Box (b -> a1 -> a2 -> b) -> Box (b -> c) -> b -> Str a1 -> Str a2 -> Str c
- data Str a = !a ::: (O (Str a))
- zipWith :: Box (a -> b -> c) -> Str a -> Str b -> Str c
- zip :: Str a -> Str b -> Str (a :* b)
- unfold :: Stable a => Box (a -> a) -> a -> Str a
- filter :: Box (a -> Bool) -> Str a -> Str (Maybe' a)
- integral :: (Stable a, VectorSpace a s) => a -> Str s -> Str a -> Str a
Documentation
tl :: Str a -> O (Str a) Source #
Get the tail of a stream, i.e. the remainder after removing the first element.
const :: Stable a => a -> Str a Source #
Construct a stream that has the same given value at each step.
constBox :: Box a -> Str a Source #
Variant of const
that allows any type a
as argument as long
as it is boxed.
shift :: Stable a => a -> Str a -> Str a Source #
Given a value a and a stream as, this function produces a stream that behaves like
shiftMany :: Stable a => List a -> Str a -> Str a Source #
Given a list [a1, ..., an]
of elements and a stream xs
this
function constructs a stream that starts with the elements a1, ...,
an
, and then proceeds as xs
. In particular, this means that the
ith element of the original stream xs
is the (i+n)th element of
the new stream. In other words shiftMany
behaves like reapeatedly
applying shift
for each element in the list.
scanMap2 :: Stable b => Box (b -> a1 -> a2 -> b) -> Box (b -> c) -> b -> Str a1 -> Str a2 -> Str c Source #
zipWith :: Box (a -> b -> c) -> Str a -> Str b -> Str c Source #
Similar to zipWith
on Haskell lists.
unfold :: Stable a => Box (a -> a) -> a -> Str a Source #
Construct a stream by repeatedly applying a function to a given
start element. That is, unfold (box f) x
will produce the stream
x ::: f x ::: f (f x) ::: ...