Copyright | Copyright (c) 1998-1999, 2008 Chris Okasaki |
---|---|
License | MIT; see COPYRIGHT file for terms and conditions |
Maintainer | robdockins AT fastmail DOT fm |
Stability | stable |
Portability | GHC, Hugs (MPTC and FD) |
Safe Haskell | None |
Language | Haskell2010 |
This module defines a sequence adaptor Sized s
.
If s
is a sequence type constructor, then Sized s
is a sequence type constructor that is identical to s
,
except that it also keeps track of the current size of
each sequence.
All time complexities are determined by the underlying
sequence, except that size becomes O( 1 )
.
- data Sized s a
- empty :: Sequence s => Sized s a
- singleton :: Sequence s => a -> Sized s a
- lcons :: Sequence s => a -> Sized s a -> Sized s a
- rcons :: Sequence s => a -> Sized s a -> Sized s a
- append :: Sequence s => Sized s a -> Sized s a -> Sized s a
- lview :: (Sequence s, Monad m) => Sized s a -> m (a, Sized s a)
- lhead :: Sequence s => Sized s a -> a
- ltail :: Sequence s => Sized s a -> Sized s a
- rview :: (Sequence s, Monad m) => Sized s a -> m (a, Sized s a)
- rhead :: Sequence s => Sized s a -> a
- rtail :: Sequence s => Sized s a -> Sized s a
- lheadM :: (Sequence s, Monad m) => Sized s a -> m a
- ltailM :: (Sequence s, Monad m) => Sized s a -> m (Sized s a)
- rheadM :: (Sequence s, Monad m) => Sized s a -> m a
- rtailM :: (Sequence s, Monad m) => Sized s a -> m (Sized s a)
- null :: Sequence s => Sized s a -> Bool
- size :: Sequence s => Sized s a -> Int
- concat :: Sequence s => Sized s (Sized s a) -> Sized s a
- reverse :: Sequence s => Sized s a -> Sized s a
- reverseOnto :: Sequence s => Sized s a -> Sized s a -> Sized s a
- fromList :: Sequence s => [a] -> Sized s a
- toList :: Sequence s => Sized s a -> [a]
- map :: Sequence s => (a -> b) -> Sized s a -> Sized s b
- concatMap :: Sequence s => (a -> Sized s b) -> Sized s a -> Sized s b
- fold :: Sequence s => (a -> b -> b) -> b -> Sized s a -> b
- fold' :: Sequence s => (a -> b -> b) -> b -> Sized s a -> b
- fold1 :: Sequence s => (a -> a -> a) -> Sized s a -> a
- fold1' :: Sequence s => (a -> a -> a) -> Sized s a -> a
- foldr :: Sequence s => (a -> b -> b) -> b -> Sized s a -> b
- foldr' :: Sequence s => (a -> b -> b) -> b -> Sized s a -> b
- foldl :: Sequence s => (b -> a -> b) -> b -> Sized s a -> b
- foldl' :: Sequence s => (b -> a -> b) -> b -> Sized s a -> b
- foldr1 :: Sequence s => (a -> a -> a) -> Sized s a -> a
- foldr1' :: Sequence s => (a -> a -> a) -> Sized s a -> a
- foldl1 :: Sequence s => (a -> a -> a) -> Sized s a -> a
- foldl1' :: Sequence s => (a -> a -> a) -> Sized s a -> a
- reducer :: Sequence s => (a -> a -> a) -> a -> Sized s a -> a
- reducer' :: Sequence s => (a -> a -> a) -> a -> Sized s a -> a
- reducel :: Sequence s => (a -> a -> a) -> a -> Sized s a -> a
- reducel' :: Sequence s => (a -> a -> a) -> a -> Sized s a -> a
- reduce1 :: Sequence s => (a -> a -> a) -> Sized s a -> a
- reduce1' :: Sequence s => (a -> a -> a) -> Sized s a -> a
- copy :: Sequence s => Int -> a -> Sized s a
- inBounds :: Sequence s => Int -> Sized s a -> Bool
- lookup :: Sequence s => Int -> Sized s a -> a
- lookupM :: (Sequence s, Monad m) => Int -> Sized s a -> m a
- lookupWithDefault :: Sequence s => a -> Int -> Sized s a -> a
- update :: Sequence s => Int -> a -> Sized s a -> Sized s a
- adjust :: Sequence s => (a -> a) -> Int -> Sized s a -> Sized s a
- mapWithIndex :: Sequence s => (Int -> a -> b) -> Sized s a -> Sized s b
- foldrWithIndex :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> b
- foldlWithIndex :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> b
- foldrWithIndex' :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> b
- foldlWithIndex' :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> b
- take :: Sequence s => Int -> Sized s a -> Sized s a
- drop :: Sequence s => Int -> Sized s a -> Sized s a
- splitAt :: Sequence s => Int -> Sized s a -> (Sized s a, Sized s a)
- subseq :: Sequence s => Int -> Int -> Sized s a -> Sized s a
- filter :: Sequence s => (a -> Bool) -> Sized s a -> Sized s a
- partition :: Sequence s => (a -> Bool) -> Sized s a -> (Sized s a, Sized s a)
- takeWhile :: Sequence s => (a -> Bool) -> Sized s a -> Sized s a
- dropWhile :: Sequence s => (a -> Bool) -> Sized s a -> Sized s a
- splitWhile :: Sequence s => (a -> Bool) -> Sized s a -> (Sized s a, Sized s a)
- zip :: Sequence s => Sized s a -> Sized s b -> Sized s (a, b)
- zip3 :: Sequence s => Sized s a -> Sized s b -> Sized s c -> Sized s (a, b, c)
- zipWith :: Sequence s => (a -> b -> c) -> Sized s a -> Sized s b -> Sized s c
- zipWith3 :: Sequence s => (a -> b -> c -> d) -> Sized s a -> Sized s b -> Sized s c -> Sized s d
- unzip :: Sequence s => Sized s (a, b) -> (Sized s a, Sized s b)
- unzip3 :: Sequence s => Sized s (a, b, c) -> (Sized s a, Sized s b, Sized s c)
- unzipWith :: Sequence s => (a -> b) -> (a -> c) -> Sized s a -> (Sized s b, Sized s c)
- unzipWith3 :: Sequence s => (a -> b) -> (a -> c) -> (a -> d) -> Sized s a -> (Sized s b, Sized s c, Sized s d)
- strict :: Sequence s => Sized s a -> Sized s a
- strictWith :: Sequence s => (a -> b) -> Sized s a -> Sized s a
- structuralInvariant :: Sequence s => Sized s a -> Bool
- moduleName :: String
- instanceName :: Sequence s => Sized s a -> String
- fromSeq :: Sequence s => s a -> Sized s a
- toSeq :: Sequence s => Sized s a -> s a
Sized Sequence Type
Sequence s => Monad (Sized s) Source | |
Sequence s => Functor (Sized s) Source | |
Sequence s => Applicative (Sized s) Source | |
Sequence s => Sequence (Sized s) Source | |
Sequence s => Alternative (Sized s) Source | |
Sequence s => MonadPlus (Sized s) Source | |
Eq (s a) => Eq (Sized s a) Source | |
(Sequence s, Ord a, Eq (s a)) => Ord (Sized s a) Source | |
(Sequence s, Read (s a)) => Read (Sized s a) Source | |
(Sequence s, Show (s a)) => Show (Sized s a) Source | |
(Sequence s, Arbitrary (s a)) => Arbitrary (Sized s a) Source | |
(Sequence s, CoArbitrary (s a)) => CoArbitrary (Sized s a) Source | |
Sequence s => Monoid (Sized s a) Source |
Sequence Operations
lookupWithDefault :: Sequence s => a -> Int -> Sized s a -> a Source
foldrWithIndex :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> b Source
foldlWithIndex :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> b Source
foldrWithIndex' :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> b Source
foldlWithIndex' :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> b Source
zipWith3 :: Sequence s => (a -> b -> c -> d) -> Sized s a -> Sized s b -> Sized s c -> Sized s d Source
unzipWith3 :: Sequence s => (a -> b) -> (a -> c) -> (a -> d) -> Sized s a -> (Sized s b, Sized s c, Sized s d) Source
strictWith :: Sequence s => (a -> b) -> Sized s a -> Sized s a Source
Unit testing
structuralInvariant :: Sequence s => Sized s a -> Bool Source
Documentation
instanceName :: Sequence s => Sized s a -> String Source