Copyright | (C) 2011 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | provisional |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Anticausal streams implemented as non-empty skew binary random access lists
The Applicative zips streams, the monad diagonalizes
Synopsis
- data Stream a
- (<|) :: a -> Stream a -> Stream a
- (!!) :: Stream a -> Integer -> a
- tail :: Stream a -> Stream a
- uncons :: Stream a -> (a, Stream a)
- drop :: Integer -> Stream a -> Stream a
- dropWhile :: (a -> Bool) -> Stream a -> Stream a
- span :: (a -> Bool) -> Stream a -> ([a], Stream a)
- break :: (a -> Bool) -> Stream a -> ([a], Stream a)
- split :: (a -> Bool) -> Stream a -> ([a], Stream a)
- splitW :: (Stream a -> Bool) -> Stream a -> ([a], Stream a)
- repeat :: a -> Stream a
- insert :: Ord a => a -> Stream a -> Stream a
- insertBy :: (a -> a -> Ordering) -> a -> Stream a -> Stream a
- adjust :: Integer -> (a -> a) -> Stream a -> Stream a
- update :: Integer -> a -> Stream a -> Stream a
- from :: Num a => a -> Stream a
- indexed :: Stream a -> Stream (Integer, a)
- interleave :: Stream a -> Stream a -> Stream a
Documentation
Instances
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
insertBy :: (a -> a -> Ordering) -> a -> Stream a -> Stream a Source #
O(n). Finds the split in O(log n), but then has to recons