Since the previous functions are not strictly necessary, we should be able to implement them with just the so-called basic functions. The following functions don't rely on the fact that our stack is implemented as a list:
-------------------- top' :: Stack a -> a top' stack = fst (pop stack) -------------------- size' :: Stack a -> Int size' stack = if isEmpty stack then 0 else 1 + size' (snd (pop stack)) -------------------- listToStack' :: [a] -> Stack a listToStack' [] = emptyStack listToStack' (h:t) = push (listToStack' t) h