https://github.com/JohnL4/DependencyGraph

A graph library of your choice + State monad would do the trick. 
e.g.:  fgl Data-Graph-Inductive-Monad


Or you could store Graph state in an MVar and work as you would with stateful approach