Copyright | (C) 2008-2015 Edward Kmett (C) 2004 Dave Menendez |
---|---|
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, but since these are potentially infinite this is stricter than would be desired. You almost always want
Synopsis
- data Future a
- (<|) :: a -> Future a -> Future a
- length :: Foldable t => t a -> Int
- tail :: Future a -> Maybe (Future a)
- last :: Future a -> a
- uncons :: Future a -> (a, Maybe (Future a))
- index :: Int -> Future a -> a
- drop :: Int -> Future a -> Maybe (Future a)
- 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
- 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
Documentation
Instances
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
Basic usage:
>>>
length []
0
>>>
length ['a', 'b', 'c']
3>>>
length [1..]
* Hangs forever *
Since: base-4.8.0.0