haskellator-0.1.0.0: SI-Units supporting calculator
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Haskellator.Internal.Utils.Stack

Synopsis

Documentation

data Stack a Source #

A simple stack implementation

Instances

Instances details
Foldable Stack Source # 
Instance details

Defined in Math.Haskellator.Internal.Utils.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 #

Applicative Stack Source # 
Instance details

Defined in Math.Haskellator.Internal.Utils.Stack

Methods

pure :: a -> Stack a #

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

liftA2 :: (a -> b -> c) -> Stack a -> Stack b -> Stack c #

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

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

Functor Stack Source # 
Instance details

Defined in Math.Haskellator.Internal.Utils.Stack

Methods

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

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

Monoid (Stack a) Source # 
Instance details

Defined in Math.Haskellator.Internal.Utils.Stack

Methods

mempty :: Stack a #

mappend :: Stack a -> Stack a -> Stack a #

mconcat :: [Stack a] -> Stack a #

Semigroup (Stack a) Source # 
Instance details

Defined in Math.Haskellator.Internal.Utils.Stack

Methods

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

sconcat :: NonEmpty (Stack a) -> Stack a #

stimes :: Integral b => b -> Stack a -> Stack a #

isEmpty Source #

Arguments

:: Stack a

The stack to check

-> Bool

True if the stack is empty, False otherwise

Check if the stack is empty

mapTop Source #

Arguments

:: (a -> a)

The function to map

-> Stack a

The stack to map over

-> Stack a

The new stack, with the top element mapped

Map a function over the top element of the stack

pop Source #

Arguments

:: Stack a

The stack to pop from

-> (a, Stack a)

The popped element and the stack without the element

Pop an element from the stack. If the stack is empty, an error is thrown.

push Source #

Arguments

:: a

The element to push

-> Stack a

The stack to push onto

-> Stack a

The new stack, containing the element

Push an element onto the stack

top Source #

Arguments

:: Stack a

The stack to get the top element from

-> a

The top element

Get the top element of the stack. If the stack is empty, an error is thrown.