simple-parser-0.8.1: Simple parser combinators
Safe HaskellNone
LanguageHaskell2010

SimpleParser.Stack

Synopsis

Documentation

newtype Stack a Source #

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

Constructors

Stack 

Fields

Instances

Instances details
Functor Stack Source # 
Instance details

Defined in SimpleParser.Stack

Methods

fmap :: (a -> b) -> Stack a -> Stack b #

(<$) :: a -> Stack b -> Stack a #

Foldable Stack Source # 
Instance details

Defined in SimpleParser.Stack

Methods

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 #

toList :: Stack a -> [a] #

null :: Stack a -> Bool #

length :: Stack a -> Int #

elem :: Eq a => a -> Stack a -> Bool #

maximum :: Ord a => Stack a -> a #

minimum :: Ord a => Stack a -> a #

sum :: Num a => Stack a -> a #

product :: Num a => Stack a -> a #

Traversable Stack Source # 
Instance details

Defined in SimpleParser.Stack

Methods

traverse :: Applicative f => (a -> f b) -> Stack a -> f (Stack b) #

sequenceA :: Applicative f => Stack (f a) -> f (Stack a) #

mapM :: Monad m => (a -> m b) -> Stack a -> m (Stack b) #

sequence :: Monad m => Stack (m a) -> m (Stack a) #

Eq a => Eq (Stack a) Source # 
Instance details

Defined in SimpleParser.Stack

Methods

(==) :: Stack a -> Stack a -> Bool #

(/=) :: Stack a -> Stack a -> Bool #

Show a => Show (Stack a) Source # 
Instance details

Defined in SimpleParser.Stack

Methods

showsPrec :: Int -> Stack a -> ShowS #

show :: Stack a -> String #

showList :: [Stack a] -> ShowS #

emptyStack :: Stack a Source #

Easy constructor for the empty stack

pushStack :: a -> Stack a -> Stack a Source #

Pushes a an element onto a Stack

topStack :: Stack a -> Maybe a Source #

Returns the top element of the stack (most recently pushed).

bottomStack :: Stack a -> Maybe a Source #

Returns the bottom element of the stack (least recently pushed).

bottomUpStack :: (a -> Maybe b) -> Stack a -> Seq b Source #

Selects elements from the bottom of the stack to the top.