5.8. Implementations of Non-basic Functions

The above functions are all necessary for a stack implementation, but there are some useful functions that aren't strictly necessary:

--------------------
top :: Stack a -> a
top (MakeStack (h:_)) = h

--------------------
size :: Stack a -> Int
size (MakeStack s) = length s

--------------------
listToStack :: [a] -> Stack a
listToStack = MakeStack -- just alias the constructor function!