A finite automaton implementation in Haskell, using a digraph