streams-3.3: 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
LanguageHaskell98

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 #

Constructors

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

Instances

Functor Future # 

Methods

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

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

Applicative Future # 

Methods

pure :: a -> Future a #

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

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

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

Foldable Future # 

Methods

fold :: Monoid m => Future m -> 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 # 

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

Comonad Future # 

Methods

extract :: Future a -> a #

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

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

ComonadApply Future # 

Methods

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

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

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

Traversable1 Future # 

Methods

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

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

Alt Future # 

Methods

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

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

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

Apply Future # 

Methods

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

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

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

Extend Future # 

Methods

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

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

Foldable1 Future # 

Methods

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

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

toNonEmpty :: Future a -> NonEmpty a #

IsList (Future a) # 

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

Methods

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

show :: Future a -> String #

showList :: [Future a] -> ShowS #

type Item (Future a) # 
type Item (Future a) = a

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

O(1) cons

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

Returns the size/length of a finite structure as an Int. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

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

O(1).

last :: Future a -> a #

O(log n).

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

O(1).

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

O(log n).

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

O(log n).

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

indexed :: Future a -> Future (Int, a) #

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

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

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

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

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

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

O(log n)

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

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

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

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

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

singleton :: a -> Future a #

O(1)