RosettaCodeData/Task/Balanced-brackets/Haskell/balanced-brackets-1.hs
2023-07-01 13:44:08 -04:00

6 lines
170 B
Haskell

isMatching :: String -> Bool
isMatching = null . foldl aut []
where
aut ('[':s) ']' = s
-- aut ('{':s) '}' = s -- automaton could be extended
aut s x = x:s