Portability | GHC, Hugs (MPTC and FD) |
---|---|

Stability | stable |

Maintainer | robdockins AT fastmail DOT fm |

Safe Haskell | None |

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

Sequence s => Functor (Sized s) | |

Sequence s => MonadPlus (Sized s) | |

Sequence s => Sequence (Sized s) | |

Eq (s a) => Eq (Sized s a) | |

(Sequence s, Ord a, Eq (s a)) => Ord (Sized s a) | |

(Sequence s, Read (s a)) => Read (Sized s a) | |

(Sequence s, Show (s a)) => Show (Sized s a) | |

(Sequence s, Arbitrary (s a)) => Arbitrary (Sized s a) | |

(Sequence s, CoArbitrary (s a)) => CoArbitrary (Sized s a) | |

Sequence s => Monoid (Sized s a) |

# Sequence Operations

lookupWithDefault :: Sequence s => a -> Int -> Sized s a -> aSource

foldrWithIndex :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> bSource

foldlWithIndex :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> bSource

foldrWithIndex' :: Sequence s => (Int -> a -> b -> b) -> b -> Sized s a -> bSource

foldlWithIndex' :: Sequence s => (b -> Int -> a -> b) -> b -> Sized s a -> bSource

zipWith3 :: Sequence s => (a -> b -> c -> d) -> Sized s a -> Sized s b -> Sized s c -> Sized s dSource

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 aSource

# Unit testing

structuralInvariant :: Sequence s => Sized s a -> BoolSource

# Documentation

instanceName :: Sequence s => Sized s a -> StringSource