Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (14 sloc) 294 Bytes
module Stack (
Stack
, pop, push, empty, isEmpty
) where
type Stack a = [a]
pop :: Stack a -> (a, Stack a)
pop (x:xs) = (x,xs)
pop _ = error "pop"
push :: a -> Stack a -> Stack a
push x xs = x : xs
empty :: Stack a
empty = []
isEmpty :: Eq a => Stack a -> Bool
isEmpty = (==empty)