Safe Haskell | None |
---|---|

Language | Haskell2010 |

This implementation of the Stream data type. It's defined similarly to other implementation of infinite streams found on hackage, except the elements of the stream are strict to prevent some space leaks.

- data Stream a = Cons !a (Maybe (Stream a))
- zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c
- zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d
- fromFiniteList :: [a] -> a -> Stream a
- fromList :: [a] -> Stream a
- toList :: Stream a -> [a]
- observeStream :: Show a => String -> Stream a -> Stream a

# Documentation

Set the precedence of infix `Cons`

.

A stream is an infinite sequence of values.

zipWith :: (a -> b -> c) -> Stream a -> Stream b -> Stream c Source #

Lift a value to be a constant stream.
repeat :: a -> Stream a
repeat a = a `Cons`

repeat a

Zip two streams together.

zipWith3 :: (a -> b -> c -> d) -> Stream a -> Stream b -> Stream c -> Stream d Source #

Zip three streams together.

fromFiniteList :: [a] -> a -> Stream a Source #

Convert a list to a stream. If the list is finite, then the last element of the stream will be an error.