streams-3.3.2: Various Haskell 2010 stream comonads
Copyright(C) 2011 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Stream.Infinite.Skew

Description

Anticausal streams implemented as non-empty skew binary random access lists

The Applicative zips streams, the monad diagonalizes

Synopsis

Documentation

data Stream a Source #

Instances

Instances details
Representable Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Associated Types

type Rep Stream #

Methods

tabulate :: (Rep Stream -> a) -> Stream a #

index :: Stream a -> Rep Stream -> a #

Foldable Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

foldMap :: Monoid m => (a -> m) -> Stream a -> 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 # 
Instance details

Defined in Data.Stream.Infinite.Skew

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) #

Applicative Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

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 #

Functor Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

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

Monad Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

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

return :: a -> Stream a #

Comonad Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

extract :: Stream a -> a #

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

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

ComonadApply Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

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

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

Distributive Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

distribute :: Functor f => f (Stream a) -> Stream (f a) #

collect :: Functor f => (a -> Stream b) -> f a -> Stream (f b) #

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

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

Foldable1 Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

fold1 :: Semigroup m => Stream m -> m #

foldMap1 :: Semigroup m => (a -> m) -> Stream a -> m #

foldMap1' :: Semigroup m => (a -> m) -> Stream a -> m #

toNonEmpty :: Stream a -> NonEmpty a #

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

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

head :: Stream a -> a #

last :: Stream a -> a #

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

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

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

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

Alt Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

(<!>) :: Stream a -> Stream a -> Stream a #

some :: Applicative Stream => Stream a -> Stream [a] #

many :: Applicative Stream => Stream a -> Stream [a] #

Apply Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

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

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

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

Extend Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

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

Traversable1 Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

traverse1 :: Apply f => (a -> f b) -> Stream a -> f (Stream b) #

sequence1 :: Apply f => Stream (f b) -> f (Stream b) #

Semigroup (Stream a) Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

sconcat :: NonEmpty (Stream a) -> Stream a #

stimes :: Integral b => b -> Stream a -> Stream a #

Show a => Show (Stream a) Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

Methods

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

show :: Stream a -> String #

showList :: [Stream a] -> ShowS #

Absurd a => Absurd (Stream a) Source #

Since: 3.3.1

Instance details

Defined in Data.Stream.Infinite.Skew

Methods

absurd :: Stream a -> b #

Boring a => Boring (Stream a) Source #

Since: 3.3.1

Instance details

Defined in Data.Stream.Infinite.Skew

Methods

boring :: Stream a #

type Rep Stream Source # 
Instance details

Defined in Data.Stream.Infinite.Skew

(<|) :: a -> Stream a -> Stream a infixr 5 Source #

O(1) cons

(!!) :: Stream a -> Integer -> a Source #

O(log n).

tail :: Stream a -> Stream a Source #

O(1).

uncons :: Stream a -> (a, Stream a) Source #

O(1).

drop :: Integer -> Stream a -> Stream a Source #

O(log n).

dropWhile :: (a -> Bool) -> Stream a -> Stream a Source #

O(n).

span :: (a -> Bool) -> Stream a -> ([a], Stream a) Source #

O(n)

break :: (a -> Bool) -> Stream a -> ([a], Stream a) Source #

O(n)

split :: (a -> Bool) -> Stream a -> ([a], Stream a) Source #

(O(n), O(log n)) split at _some_ edge where function goes from False to True. best used with a monotonic function

splitW :: (Stream a -> Bool) -> Stream a -> ([a], Stream a) Source #

(O(n), O(log n)) split at _some_ edge where function goes from False to True. best used with a monotonic function

splitW p xs = (map extract &&& fmap (fmap extract)) . split p . duplicate

repeat :: a -> Stream a Source #

insert :: Ord a => a -> Stream a -> Stream a Source #

O(n)

insertBy :: (a -> a -> Ordering) -> a -> Stream a -> Stream a Source #

O(n). Finds the split in O(log n), but then has to recons

adjust :: Integer -> (a -> a) -> Stream a -> Stream a Source #

O(log n) Change the value of the nth entry in the future

update :: Integer -> a -> Stream a -> Stream a Source #

from :: Num a => a -> Stream a Source #