Using Monad/ST for non-concurrent message passing in a mutable graph
问题 I am trying to work out a data structure for the following situation. Graph Structure I plan to have a graph of nodes with un-weighted, directed edges: Graph = [Node] Each node has: Some TBD internal (persistent) state A queue of incoming messages A type of message it can send determined by a function that accepts the current node state (with the possibility of failure) A list of edges Node { nodeState :: NodeState, inbox :: Queue NodeMessage, nodeMessage :: (NodeState -> Maybe NodeMessage),