regex implementation in haskell for giggles