diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-06-07 09:08:36 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-06-07 09:08:36 +1000 |
commit | c42405fcefe59d769a06d882614b17b75eb7d51a (patch) | |
tree | e7487ce3bb22fce259724783c23bd5a5e630be33 /ProofGraph.hs | |
parent | c6a16aa9f632ba723452803800251f7e33f15e35 (diff) |
Code to generate a dependency graph of commands in a proof trace
Diffstat (limited to 'ProofGraph.hs')
-rw-r--r-- | ProofGraph.hs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/ProofGraph.hs b/ProofGraph.hs new file mode 100644 index 0000000..0cd2e7e --- /dev/null +++ b/ProofGraph.hs @@ -0,0 +1,36 @@ +module ProofGraph ( + Node(..), + Graph(..), + + empty, + insert, + delete, + union + ) where + +import Data.Set( Set ) +import qualified Data.Set as Set + + + +data Node a = Node { contents :: a + , successors :: Set (Node a) } deriving (Eq, Ord, Show) + +data Graph a = Graph { nodes :: Set (Node a) } deriving (Show) + + + +empty :: Graph a +empty = Graph Set.empty + + +insert :: Ord a => Node a -> Graph a -> Graph a +insert node graph = Graph (Set.insert node (nodes graph)) + + +delete :: Ord a => Node a -> Graph a -> Graph a +delete node graph = Graph (Set.delete node (nodes graph)) + + +union :: Ord a => Set (Node a) -> Graph a -> Graph a +union nodeSet graph = Graph (Set.union nodeSet (nodes graph)) |