Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
A stack supporting O(1) push, top, and bottom. Behind the newtype, a "push" onto the stack is implemented as "snoc", therefore fold/traverse goes from bottom of stack (most generic label) to top (most specific label).
Instances
Functor Stack Source # | |
Foldable Stack Source # | |
Defined in SimpleParser.Stack fold :: Monoid m => Stack m -> m # foldMap :: Monoid m => (a -> m) -> Stack a -> m # foldMap' :: Monoid m => (a -> m) -> Stack a -> m # foldr :: (a -> b -> b) -> b -> Stack a -> b # foldr' :: (a -> b -> b) -> b -> Stack a -> b # foldl :: (b -> a -> b) -> b -> Stack a -> b # foldl' :: (b -> a -> b) -> b -> Stack a -> b # foldr1 :: (a -> a -> a) -> Stack a -> a # foldl1 :: (a -> a -> a) -> Stack a -> a # elem :: Eq a => a -> Stack a -> Bool # maximum :: Ord a => Stack a -> a # minimum :: Ord a => Stack a -> a # | |
Traversable Stack Source # | |
Eq a => Eq (Stack a) Source # | |
Show a => Show (Stack a) Source # | |
emptyStack :: Stack a Source #
Easy constructor for the empty stack
bottomStack :: Stack a -> Maybe a Source #
Returns the bottom element of the stack (least recently pushed).