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 | Safe-Inferred |
Language | Haskell2010 |
Random-Access Lists. All operations are as listed in Data.Edison.Seq except the following:
- rhead*, size
O( log n )
- copy, inBounds
O( log i )
- lookup*, update, adjust, drop
O( min( i, log n ) )
- subseq
O( min( i, log n ) + len )
References:
- Chris Okasaki. Purely Functional Data Structures. 1998. Section 9.3.1.
- Chris Okasaki. "Purely Functional Random Access Lists". FPCA'95, pages 86-95.
Synopsis
- data Seq a
- empty :: Seq a
- singleton :: a -> Seq a
- lcons :: a -> Seq a -> Seq a
- rcons :: a -> Seq a -> Seq a
- append :: Seq a -> Seq a -> Seq a
- lview :: MonadFail m => Seq a -> m (a, Seq a)
- lhead :: Seq a -> a
- ltail :: Seq a -> Seq a
- rview :: MonadFail m => Seq a -> m (a, Seq a)
- rhead :: Seq a -> a
- rtail :: Seq a -> Seq a
- lheadM :: MonadFail m => Seq a -> m a
- ltailM :: MonadFail m => Seq a -> m (Seq a)
- rheadM :: MonadFail m => Seq a -> m a
- rtailM :: MonadFail m => Seq a -> m (Seq a)
- null :: Seq a -> Bool
- size :: Seq a -> Int
- concat :: Seq (Seq a) -> Seq a
- reverse :: Seq a -> Seq a
- reverseOnto :: Seq a -> Seq a -> Seq a
- fromList :: [a] -> Seq a
- toList :: Seq a -> [a]
- map :: (a -> b) -> Seq a -> Seq b
- concatMap :: (a -> Seq b) -> Seq a -> Seq b
- fold :: (a -> b -> b) -> b -> Seq a -> b
- fold' :: (a -> b -> b) -> b -> Seq a -> b
- fold1 :: (a -> a -> a) -> Seq a -> a
- fold1' :: (a -> a -> a) -> Seq a -> a
- foldr :: (a -> b -> b) -> b -> Seq a -> b
- foldr' :: (a -> b -> b) -> b -> Seq a -> b
- foldl :: (b -> a -> b) -> b -> Seq a -> b
- foldl' :: (b -> a -> b) -> b -> Seq a -> b
- foldr1 :: (a -> a -> a) -> Seq a -> a
- foldr1' :: (a -> a -> a) -> Seq a -> a
- foldl1 :: (a -> a -> a) -> Seq a -> a
- foldl1' :: (a -> a -> a) -> Seq a -> a
- reducer :: (a -> a -> a) -> a -> Seq a -> a
- reducer' :: (a -> a -> a) -> a -> Seq a -> a
- reducel :: (a -> a -> a) -> a -> Seq a -> a
- reducel' :: (a -> a -> a) -> a -> Seq a -> a
- reduce1 :: (a -> a -> a) -> Seq a -> a
- reduce1' :: (a -> a -> a) -> Seq a -> a
- copy :: Int -> a -> Seq a
- inBounds :: Int -> Seq a -> Bool
- lookup :: Int -> Seq a -> a
- lookupM :: MonadFail m => Int -> Seq a -> m a
- lookupWithDefault :: a -> Int -> Seq a -> a
- update :: Int -> a -> Seq a -> Seq a
- adjust :: (a -> a) -> Int -> Seq a -> Seq a
- mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b
- foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b
- foldrWithIndex' :: (Int -> a -> b -> b) -> b -> Seq a -> b
- foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b
- foldlWithIndex' :: (b -> Int -> a -> b) -> b -> Seq a -> b
- take :: Int -> Seq a -> Seq a
- drop :: Int -> Seq a -> Seq a
- splitAt :: Int -> Seq a -> (Seq a, Seq a)
- subseq :: Int -> Int -> Seq a -> Seq a
- filter :: (a -> Bool) -> Seq a -> Seq a
- partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
- takeWhile :: (a -> Bool) -> Seq a -> Seq a
- dropWhile :: (a -> Bool) -> Seq a -> Seq a
- splitWhile :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
- zip :: Seq a -> Seq b -> Seq (a, b)
- zip3 :: Seq a -> Seq b -> Seq c -> Seq (a, b, c)
- zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c
- zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d
- unzip :: Seq (a, b) -> (Seq a, Seq b)
- unzip3 :: Seq (a, b, c) -> (Seq a, Seq b, Seq c)
- unzipWith :: (a -> b) -> (a -> c) -> Seq a -> (Seq b, Seq c)
- unzipWith3 :: (a -> b) -> (a -> c) -> (a -> d) -> Seq a -> (Seq b, Seq c, Seq d)
- strict :: Seq a -> Seq a
- strictWith :: (a -> b) -> Seq a -> Seq a
- structuralInvariant :: Seq t -> Bool
- moduleName :: String
Sequence Type
Instances
Sequence Seq Source # | |
Defined in Data.Edison.Seq.RandList lcons :: a -> Seq a -> Seq a # rcons :: a -> Seq a -> Seq a # lview :: MonadFail m => Seq a -> m (a, Seq a) # lheadM :: MonadFail m => Seq a -> m a # ltailM :: MonadFail m => Seq a -> m (Seq a) # rview :: MonadFail m => Seq a -> m (a, Seq a) # rheadM :: MonadFail m => Seq a -> m a # rtailM :: MonadFail m => Seq a -> m (Seq a) # concat :: Seq (Seq a) -> Seq a # reverseOnto :: Seq a -> Seq a -> Seq a # fold :: (a -> b -> b) -> b -> Seq a -> b # fold' :: (a -> b -> b) -> b -> Seq a -> b # fold1 :: (a -> a -> a) -> Seq a -> a # fold1' :: (a -> a -> a) -> Seq a -> a # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldr1' :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # foldl1' :: (a -> a -> a) -> Seq a -> a # reducer :: (a -> a -> a) -> a -> Seq a -> a # reducer' :: (a -> a -> a) -> a -> Seq a -> a # reducel :: (a -> a -> a) -> a -> Seq a -> a # reducel' :: (a -> a -> a) -> a -> Seq a -> a # reduce1 :: (a -> a -> a) -> Seq a -> a # reduce1' :: (a -> a -> a) -> Seq a -> a # take :: Int -> Seq a -> Seq a # drop :: Int -> Seq a -> Seq a # splitAt :: Int -> Seq a -> (Seq a, Seq a) # subseq :: Int -> Int -> Seq a -> Seq a # filter :: (a -> Bool) -> Seq a -> Seq a # partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a) # takeWhile :: (a -> Bool) -> Seq a -> Seq a # dropWhile :: (a -> Bool) -> Seq a -> Seq a # splitWhile :: (a -> Bool) -> Seq a -> (Seq a, Seq a) # inBounds :: Int -> Seq a -> Bool # lookupM :: MonadFail m => Int -> Seq a -> m a # lookupWithDefault :: a -> Int -> Seq a -> a # update :: Int -> a -> Seq a -> Seq a # adjust :: (a -> a) -> Int -> Seq a -> Seq a # mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b # foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b # foldrWithIndex' :: (Int -> a -> b -> b) -> b -> Seq a -> b # foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b # foldlWithIndex' :: (b -> Int -> a -> b) -> b -> Seq a -> b # zip :: Seq a -> Seq b -> Seq (a, b) # zip3 :: Seq a -> Seq b -> Seq c -> Seq (a, b, c) # zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c # zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d # unzip :: Seq (a, b) -> (Seq a, Seq b) # unzip3 :: Seq (a, b, c) -> (Seq a, Seq b, Seq c) # unzipWith :: (a -> b) -> (a -> c) -> Seq a -> (Seq b, Seq c) # unzipWith3 :: (a -> b) -> (a -> c) -> (a -> d) -> Seq a -> (Seq b, Seq c, Seq d) # strictWith :: (a -> b) -> Seq a -> Seq a # structuralInvariant :: Seq a -> Bool # instanceName :: Seq a -> String # | |
Alternative Seq Source # | |
Applicative Seq Source # | |
Functor Seq Source # | |
Monad Seq Source # | |
MonadPlus Seq Source # | |
Arbitrary a => Arbitrary (Seq a) Source # | |
CoArbitrary a => CoArbitrary (Seq a) Source # | |
Defined in Data.Edison.Seq.RandList coarbitrary :: Seq a -> Gen b -> Gen b # | |
Monoid (Seq a) Source # | |
Semigroup (Seq a) Source # | |
Read a => Read (Seq a) Source # | |
Show a => Show (Seq a) Source # | |
Eq a => Eq (Seq a) Source # | |
Ord a => Ord (Seq a) Source # | |
Sequence Operations
lookupWithDefault :: a -> Int -> Seq a -> a Source #
foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b Source #
foldrWithIndex' :: (Int -> a -> b -> b) -> b -> Seq a -> b Source #
foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b Source #
foldlWithIndex' :: (b -> Int -> a -> b) -> b -> Seq a -> b Source #
strictWith :: (a -> b) -> Seq a -> Seq a Source #
Unit testing
structuralInvariant :: Seq t -> Bool Source #
Documentation
moduleName :: String Source #