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 `Rev s`

.
If `s`

is a sequence type constructor, then `Rev s`

is a sequence type constructor that is identical to `s`

,
except that it is kept in the opposite order.
Also keeps explicit track of the size of the sequence,
similar to the `Sized`

adaptor in Data.Edison.Seq.SizedSeq.

This module is most useful when s is a sequence type that offers fast access to the front but slow access to the rear, and your application needs the opposite (i.e., fast access to the rear but slow access to the front).

All time complexities are determined by the underlying
sequence, except that the complexities for accessing
the left and right sides of the sequence are exchanged,
and size becomes `O( 1 )`

.

- data Rev s a
- empty :: Sequence s => Rev s a
- singleton :: Sequence s => a -> Rev s a
- lcons :: Sequence s => a -> Rev s a -> Rev s a
- rcons :: Sequence s => a -> Rev s a -> Rev s a
- append :: Sequence s => Rev s a -> Rev s a -> Rev s a
- lview :: (Sequence s, Monad m) => Rev s a -> m (a, Rev s a)
- lhead :: Sequence s => Rev s a -> a
- ltail :: Sequence s => Rev s a -> Rev s a
- rview :: (Sequence s, Monad m) => Rev s a -> m (a, Rev s a)
- rhead :: Sequence s => Rev s a -> a
- rtail :: Sequence s => Rev s a -> Rev s a
- lheadM :: (Sequence s, Monad m) => Rev s a -> m a
- ltailM :: (Sequence s, Monad m) => Rev s a -> m (Rev s a)
- rheadM :: (Sequence s, Monad m) => Rev s a -> m a
- rtailM :: (Sequence s, Monad m) => Rev s a -> m (Rev s a)
- null :: Sequence s => Rev s a -> Bool
- size :: Sequence s => Rev s a -> Int
- concat :: Sequence s => Rev s (Rev s a) -> Rev s a
- reverse :: Sequence s => Rev s a -> Rev s a
- reverseOnto :: Sequence s => Rev s a -> Rev s a -> Rev s a
- fromList :: Sequence s => [a] -> Rev s a
- toList :: Sequence s => Rev s a -> [a]
- map :: Sequence s => (a -> b) -> Rev s a -> Rev s b
- concatMap :: Sequence s => (a -> Rev s b) -> Rev s a -> Rev s b
- fold :: Sequence s => (a -> b -> b) -> b -> Rev s a -> b
- fold' :: Sequence s => (a -> b -> b) -> b -> Rev s a -> b
- fold1 :: Sequence s => (a -> a -> a) -> Rev s a -> a
- fold1' :: Sequence s => (a -> a -> a) -> Rev s a -> a
- foldr :: Sequence s => (a -> b -> b) -> b -> Rev s a -> b
- foldr' :: Sequence s => (a -> b -> b) -> b -> Rev s a -> b
- foldl :: Sequence s => (b -> a -> b) -> b -> Rev s a -> b
- foldl' :: Sequence s => (b -> a -> b) -> b -> Rev s a -> b
- foldr1 :: Sequence s => (a -> a -> a) -> Rev s a -> a
- foldr1' :: Sequence s => (a -> a -> a) -> Rev s a -> a
- foldl1 :: Sequence s => (a -> a -> a) -> Rev s a -> a
- foldl1' :: Sequence s => (a -> a -> a) -> Rev s a -> a
- reducer :: Sequence s => (a -> a -> a) -> a -> Rev s a -> a
- reducer' :: Sequence s => (a -> a -> a) -> a -> Rev s a -> a
- reducel :: Sequence s => (a -> a -> a) -> a -> Rev s a -> a
- reducel' :: Sequence s => (a -> a -> a) -> a -> Rev s a -> a
- reduce1 :: Sequence s => (a -> a -> a) -> Rev s a -> a
- reduce1' :: Sequence s => (a -> a -> a) -> Rev s a -> a
- copy :: Sequence s => Int -> a -> Rev s a
- inBounds :: Sequence s => Int -> Rev s a -> Bool
- lookup :: Sequence s => Int -> Rev s a -> a
- lookupM :: (Sequence s, Monad m) => Int -> Rev s a -> m a
- lookupWithDefault :: Sequence s => a -> Int -> Rev s a -> a
- update :: Sequence s => Int -> a -> Rev s a -> Rev s a
- adjust :: Sequence s => (a -> a) -> Int -> Rev s a -> Rev s a
- mapWithIndex :: Sequence s => (Int -> a -> b) -> Rev s a -> Rev s b
- foldrWithIndex :: Sequence s => (Int -> a -> b -> b) -> b -> Rev s a -> b
- foldrWithIndex' :: Sequence s => (Int -> a -> b -> b) -> b -> Rev s a -> b
- foldlWithIndex :: Sequence s => (b -> Int -> a -> b) -> b -> Rev s a -> b
- foldlWithIndex' :: Sequence s => (b -> Int -> a -> b) -> b -> Rev s a -> b
- take :: Sequence s => Int -> Rev s a -> Rev s a
- drop :: Sequence s => Int -> Rev s a -> Rev s a
- splitAt :: Sequence s => Int -> Rev s a -> (Rev s a, Rev s a)
- subseq :: Sequence s => Int -> Int -> Rev s a -> Rev s a
- filter :: Sequence s => (a -> Bool) -> Rev s a -> Rev s a
- partition :: Sequence s => (a -> Bool) -> Rev s a -> (Rev s a, Rev s a)
- takeWhile :: Sequence s => (a -> Bool) -> Rev s a -> Rev s a
- dropWhile :: Sequence s => (a -> Bool) -> Rev s a -> Rev s a
- splitWhile :: Sequence s => (a -> Bool) -> Rev s a -> (Rev s a, Rev s a)
- zip :: Sequence s => Rev s a -> Rev s b -> Rev s (a, b)
- zip3 :: Sequence s => Rev s a -> Rev s b -> Rev s c -> Rev s (a, b, c)
- zipWith :: Sequence s => (a -> b -> c) -> Rev s a -> Rev s b -> Rev s c
- zipWith3 :: Sequence s => (a -> b -> c -> d) -> Rev s a -> Rev s b -> Rev s c -> Rev s d
- unzip :: Sequence s => Rev s (a, b) -> (Rev s a, Rev s b)
- unzip3 :: Sequence s => Rev s (a, b, c) -> (Rev s a, Rev s b, Rev s c)
- unzipWith :: Sequence s => (a -> b) -> (a -> c) -> Rev s a -> (Rev s b, Rev s c)
- unzipWith3 :: Sequence s => (a -> b) -> (a -> c) -> (a -> d) -> Rev s a -> (Rev s b, Rev s c, Rev s d)
- strict :: Sequence s => Rev s a -> Rev s a
- strictWith :: Sequence s => (a -> b) -> Rev s a -> Rev s a
- structuralInvariant :: Sequence s => Rev s a -> Bool
- moduleName :: String
- instanceName :: Sequence s => Rev s a -> String
- fromSeq :: Sequence s => s a -> Rev s a
- toSeq :: Sequence s => Rev s a -> s a

# Rev Sequence Type

Sequence s => Monad (Rev s) Source | |

Sequence s => Functor (Rev s) Source | |

Sequence s => Applicative (Rev s) Source | |

Sequence s => Sequence (Rev s) Source | |

Sequence s => Alternative (Rev s) Source | |

Sequence s => MonadPlus (Rev s) Source | |

Eq (s a) => Eq (Rev s a) Source | |

(Sequence s, Ord a, Eq (s a)) => Ord (Rev s a) Source | |

(Sequence s, Read (s a)) => Read (Rev s a) Source | |

(Sequence s, Show (s a)) => Show (Rev s a) Source | |

(Sequence s, Arbitrary (s a)) => Arbitrary (Rev s a) Source | |

(Sequence s, CoArbitrary (s a)) => CoArbitrary (Rev s a) Source | |

Sequence s => Monoid (Rev s a) Source |

# Sequence Operations

lookupWithDefault :: Sequence s => a -> Int -> Rev s a -> a Source

foldrWithIndex :: Sequence s => (Int -> a -> b -> b) -> b -> Rev s a -> b Source

foldrWithIndex' :: Sequence s => (Int -> a -> b -> b) -> b -> Rev s a -> b Source

foldlWithIndex :: Sequence s => (b -> Int -> a -> b) -> b -> Rev s a -> b Source

foldlWithIndex' :: Sequence s => (b -> Int -> a -> b) -> b -> Rev s a -> b Source

unzipWith3 :: Sequence s => (a -> b) -> (a -> c) -> (a -> d) -> Rev s a -> (Rev s b, Rev s c, Rev s d) Source

strictWith :: Sequence s => (a -> b) -> Rev s a -> Rev s a Source

# Unit testing

structuralInvariant :: Sequence s => Rev s a -> Bool Source

# Documentation

instanceName :: Sequence s => Rev s a -> String Source