kansas-lava-0.2.4.2: Kansas Lava is a hardware simulator and VHDL generator.

Safe HaskellNone
LanguageHaskell2010

Language.KansasLava.Stream

Description

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.

Synopsis

Documentation

data Stream a Source

Set the precedence of infix Cons.

A stream is an infinite sequence of values.

Constructors

Cons !a (Maybe (Stream a)) infixr 5

Cons takes a head and an optional tail. If the tail is empty, then the last value is repeated.

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.

fromList :: [a] -> Stream a Source

toList :: Stream a -> [a] Source

Convert a Stream to a lazy list.