--
-- Abstract Data Types
--

{-- A Stack ADT
data Stack a

newStack :: Stack a
push :: Stack a -> a -> Stack a 
pop :: Stack a -> (Stack a,a)
isEmpty :: Stack a -> Bool

---}

module StackADT2 (Stack,newStack,push,pop,isEmpty) where

type Stack a  = [a]  --- type synonym

newStack :: Stack a
push :: Stack a -> a -> Stack a 
pop :: Stack a -> (Stack a,a)
isEmpty :: Stack a -> Bool


newStack   = []
push s e   = e:s
pop (e:s)  = (s,e)
isEmpty [] = True
isEmpty _  = False

