kansas-lava-0.2.4.5: 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.

Instances

Functor Stream Source # 

Methods

fmap :: (a -> b) -> Stream a -> Stream b #

(<$) :: a -> Stream b -> Stream a #

Applicative Stream Source # 

Methods

pure :: a -> Stream a #

(<*>) :: Stream (a -> b) -> Stream a -> Stream b #

liftA2 :: (a -> b -> c) -> Stream a -> Stream b -> Stream c #

(*>) :: Stream a -> Stream b -> Stream b #

(<*) :: Stream a -> Stream b -> Stream a #

Foldable Stream Source # 

Methods

fold :: Monoid m => Stream m -> m #

foldMap :: Monoid m => (a -> m) -> Stream a -> m #

foldr :: (a -> b -> b) -> b -> Stream a -> b #

foldr' :: (a -> b -> b) -> b -> Stream a -> b #

foldl :: (b -> a -> b) -> b -> Stream a -> b #

foldl' :: (b -> a -> b) -> b -> Stream a -> b #

foldr1 :: (a -> a -> a) -> Stream a -> a #

foldl1 :: (a -> a -> a) -> Stream a -> a #

toList :: Stream a -> [a] #

null :: Stream a -> Bool #

length :: Stream a -> Int #

elem :: Eq a => a -> Stream a -> Bool #

maximum :: Ord a => Stream a -> a #

minimum :: Ord a => Stream a -> a #

sum :: Num a => Stream a -> a #

product :: Num a => Stream a -> a #

Traversable Stream Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Stream a -> f (Stream b) #

sequenceA :: Applicative f => Stream (f a) -> f (Stream a) #

mapM :: Monad m => (a -> m b) -> Stream a -> m (Stream b) #

sequence :: Monad m => Stream (m a) -> m (Stream a) #

Show a => Show (Stream a) Source # 

Methods

showsPrec :: Int -> Stream a -> ShowS #

show :: Stream a -> String #

showList :: [Stream a] -> ShowS #

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.