Suffix automata implementation in Haskell