How to write Haskell function to verify parentheses matching?
- by Rizo
I need to write a function par :: String -> Bool to verify if a given string with parentheses is matching using stack module.
Ex:
par "(((()[()])))" = True
par "((]())" = False
Here's my stack module implementation:
module Stack (Stack,
push, pop, top,
empty, isEmpty)
where
data Stack a = Stk [a]
…