data Stack a = Empty | Push (Stack a) a pop Empty = error "pop of empty stack" pop (Push s e) = s top Empty = error "top of empty stack" top (Push s e) = e is_empty Empty = True is_empty (Push s e) = False test = top $ pop $ Push (Push Empty 3) 8