Copyright | (c) Alec Theriault 2017-2018 |
---|---|
License | BSD-style |
Maintainer | alec.theriault@gmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Datatypes wrapping lists and non-empty lists designed for fast append (as opposed to prepend) along with the usual class instances.
Documentation
Wrap a data type where all the operations are reversed
Reversed (f a) |
Instances
Functor f => Functor (Reversed f) Source # | |
Foldable (Reversed []) Source # | |
Defined in Language.Rust.Parser.Reversed fold :: Monoid m => Reversed [] m -> m # foldMap :: Monoid m => (a -> m) -> Reversed [] a -> m # foldr :: (a -> b -> b) -> b -> Reversed [] a -> b # foldr' :: (a -> b -> b) -> b -> Reversed [] a -> b # foldl :: (b -> a -> b) -> b -> Reversed [] a -> b # foldl' :: (b -> a -> b) -> b -> Reversed [] a -> b # foldr1 :: (a -> a -> a) -> Reversed [] a -> a # foldl1 :: (a -> a -> a) -> Reversed [] a -> a # toList :: Reversed [] a -> [a] # null :: Reversed [] a -> Bool # length :: Reversed [] a -> Int # elem :: Eq a => a -> Reversed [] a -> Bool # maximum :: Ord a => Reversed [] a -> a # minimum :: Ord a => Reversed [] a -> a # | |
Foldable (Reversed NonEmpty) Source # | |
Defined in Language.Rust.Parser.Reversed fold :: Monoid m => Reversed NonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> Reversed NonEmpty a -> m # foldr :: (a -> b -> b) -> b -> Reversed NonEmpty a -> b # foldr' :: (a -> b -> b) -> b -> Reversed NonEmpty a -> b # foldl :: (b -> a -> b) -> b -> Reversed NonEmpty a -> b # foldl' :: (b -> a -> b) -> b -> Reversed NonEmpty a -> b # foldr1 :: (a -> a -> a) -> Reversed NonEmpty a -> a # foldl1 :: (a -> a -> a) -> Reversed NonEmpty a -> a # toList :: Reversed NonEmpty a -> [a] # null :: Reversed NonEmpty a -> Bool # length :: Reversed NonEmpty a -> Int # elem :: Eq a => a -> Reversed NonEmpty a -> Bool # maximum :: Ord a => Reversed NonEmpty a -> a # minimum :: Ord a => Reversed NonEmpty a -> a # | |
IsList (f a) => IsList (Reversed f a) Source # | |
(Typeable f, Typeable a, Data (f a)) => Data (Reversed f a) Source # | |
Defined in Language.Rust.Parser.Reversed gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Reversed f a -> c (Reversed f a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Reversed f a) # toConstr :: Reversed f a -> Constr # dataTypeOf :: Reversed f a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Reversed f a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Reversed f a)) # gmapT :: (forall b. Data b => b -> b) -> Reversed f a -> Reversed f a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Reversed f a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Reversed f a -> r # gmapQ :: (forall d. Data d => d -> u) -> Reversed f a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Reversed f a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Reversed f a -> m (Reversed f a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Reversed f a -> m (Reversed f a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Reversed f a -> m (Reversed f a) # | |
Semigroup (f a) => Semigroup (Reversed f a) Source # | |
Monoid (f a) => Monoid (Reversed f a) Source # | |
Located (f a) => Located (Reversed f a) Source # | |
type Item (Reversed f a) Source # | |
Defined in Language.Rust.Parser.Reversed |
toNonEmpty :: Reversed NonEmpty a -> NonEmpty a Source #
Convert a reversed NonEmpty
back into a normal one.
unsnoc :: Reversed NonEmpty a -> (Reversed [] a, a) Source #
Remove an element from the end of a non-empty reversed sequence
snoc :: Reversed [] a -> a -> Reversed NonEmpty a Source #
Add an element to the end of a reversed sequence to produce a non-empty reversed sequence
Instances
Functor NonEmpty Source # | |
Foldable NonEmpty Source # | |
Defined in Language.Rust.Parser.NonEmpty fold :: Monoid m => NonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m # foldr :: (a -> b -> b) -> b -> NonEmpty a -> b # foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b # foldl :: (b -> a -> b) -> b -> NonEmpty a -> b # foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b # foldr1 :: (a -> a -> a) -> NonEmpty a -> a # foldl1 :: (a -> a -> a) -> NonEmpty a -> a # elem :: Eq a => a -> NonEmpty a -> Bool # maximum :: Ord a => NonEmpty a -> a # minimum :: Ord a => NonEmpty a -> a # | |
Traversable NonEmpty Source # | |
IsList (NonEmpty a) Source # | |
Eq a => Eq (NonEmpty a) Source # | |
Data a => Data (NonEmpty a) Source # | |
Defined in Language.Rust.Parser.NonEmpty gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NonEmpty a -> c (NonEmpty a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NonEmpty a) # toConstr :: NonEmpty a -> Constr # dataTypeOf :: NonEmpty a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (NonEmpty a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NonEmpty a)) # gmapT :: (forall b. Data b => b -> b) -> NonEmpty a -> NonEmpty a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r # gmapQ :: (forall d. Data d => d -> u) -> NonEmpty a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NonEmpty a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) # | |
Ord a => Ord (NonEmpty a) Source # | |
Defined in Language.Rust.Parser.NonEmpty | |
Show a => Show (NonEmpty a) Source # | |
Foldable (Reversed NonEmpty) Source # | |
Defined in Language.Rust.Parser.Reversed fold :: Monoid m => Reversed NonEmpty m -> m # foldMap :: Monoid m => (a -> m) -> Reversed NonEmpty a -> m # foldr :: (a -> b -> b) -> b -> Reversed NonEmpty a -> b # foldr' :: (a -> b -> b) -> b -> Reversed NonEmpty a -> b # foldl :: (b -> a -> b) -> b -> Reversed NonEmpty a -> b # foldl' :: (b -> a -> b) -> b -> Reversed NonEmpty a -> b # foldr1 :: (a -> a -> a) -> Reversed NonEmpty a -> a # foldl1 :: (a -> a -> a) -> Reversed NonEmpty a -> a # toList :: Reversed NonEmpty a -> [a] # null :: Reversed NonEmpty a -> Bool # length :: Reversed NonEmpty a -> Int # elem :: Eq a => a -> Reversed NonEmpty a -> Bool # maximum :: Ord a => Reversed NonEmpty a -> a # minimum :: Ord a => Reversed NonEmpty a -> a # | |
Semigroup (NonEmpty a) Source # | |
NFData a => NFData (NonEmpty a) Source # | |
Defined in Language.Rust.Parser.NonEmpty | |
Located a => Located (NonEmpty a) Source # | O(n) time complexity |
type Item (NonEmpty a) Source # | |
Defined in Language.Rust.Parser.NonEmpty |