Haskell DFA and NFA Implementation