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

Data.Stream.Future.Skew

Description

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

The Applicative zips streams, but since these are potentially infinite this is stricter than would be desired. You almost always want

Synopsis

Documentation

data Future a Source #

Constructors

Last !(Complete a) 
!(Complete a) :< (Future a) infixr 5 

Instances

Instances details
Foldable Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

foldMap' :: Monoid m => (a -> m) -> Future a -> m #

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

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

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

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

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

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

toList :: Future a -> [a] #

null :: Future a -> Bool #

length :: Future a -> Int #

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

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

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

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

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

Traversable Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

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

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

Applicative Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

pure :: a -> Future a #

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

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

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

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

Functor Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

Comonad Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

extract :: Future a -> a #

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

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

ComonadApply Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

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

Foldable1 Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

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

toNonEmpty :: Future a -> NonEmpty a #

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

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

head :: Future a -> a #

last :: Future a -> a #

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

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

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

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

Alt Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

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

Apply Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

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

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

Extend Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

Traversable1 Future Source # 
Instance details

Defined in Data.Stream.Future.Skew

Methods

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

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

IsList (Future a) Source # 
Instance details

Defined in Data.Stream.Future.Skew

Associated Types

type Item (Future a) #

Methods

fromList :: [Item (Future a)] -> Future a #

fromListN :: Int -> [Item (Future a)] -> Future a #

toList :: Future a -> [Item (Future a)] #

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

Defined in Data.Stream.Future.Skew

Methods

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

show :: Future a -> String #

showList :: [Future a] -> ShowS #

type Item (Future a) Source # 
Instance details

Defined in Data.Stream.Future.Skew

type Item (Future a) = a

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

O(1) cons

length :: Foldable t => t a -> Int #

Returns the size/length of a finite structure as an Int. The default implementation just counts elements starting with the leftmost. Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

Examples

Expand

Basic usage:

>>> length []
0
>>> length ['a', 'b', 'c']
3
>>> length [1..]
* Hangs forever *

Since: base-4.8.0.0

tail :: Future a -> Maybe (Future a) Source #

O(1).

last :: Future a -> a Source #

O(log n).

uncons :: Future a -> (a, Maybe (Future a)) Source #

O(1).

index :: Int -> Future a -> a Source #

O(log n).

drop :: Int -> Future a -> Maybe (Future a) Source #

O(log n).

dropWhile :: (a -> Bool) -> Future a -> Maybe (Future a) Source #

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

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

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

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

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

replicate :: Int -> a -> Future a Source #

O(log n)

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

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

update :: Int -> a -> Future a -> Future a Source #

adjust :: Int -> (a -> a) -> Future a -> Future a Source #

toFuture :: [a] -> Maybe (Future a) Source #

singleton :: a -> Future a Source #

O(1)