A regex parser written in Haskell