From 42a265e80a9ed551fd519a88ed1d063435385b9f Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 12 Jul 2012 09:09:31 +1000 Subject: Graph generating functions accessible as a module --- ProofGraph.hs | 19 ++++++++----------- ProofGraphMain.hs | 11 +++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 ProofGraphMain.hs diff --git a/ProofGraph.hs b/ProofGraph.hs index 1a6f3fe..816e9f0 100644 --- a/ProofGraph.hs +++ b/ProofGraph.hs @@ -1,5 +1,10 @@ -import System( getArgs ) -import Text.Printf +module ProofGraph ( + PGraph, + doGraphGen + ) where + + + import Data.Maybe import Data.List import Data.Set( Set ) @@ -11,7 +16,7 @@ import qualified Data.Graph.Inductive.Graph as Graph import Data.Graph.Inductive.Tree import Stack( Stack, at, (<:>) ) import qualified Stack as Stack -import Parse +import Parse( isNumber, isName ) @@ -118,11 +123,3 @@ doGraphGen list = result = foldl' parse (graph,stack,dictionary) list in case result of (g,s,d) -> g - - -main = do - args <- getArgs - list <- getLines $ head args - let result = doGraphGen (map (stripReturn) list) - printf $ (show result) ++ "\n" - diff --git a/ProofGraphMain.hs b/ProofGraphMain.hs new file mode 100644 index 0000000..91767ad --- /dev/null +++ b/ProofGraphMain.hs @@ -0,0 +1,11 @@ +import System( getArgs ) +import Text.Printf +import Parse +import ProofGraph + + +main = do + args <- getArgs + list <- getLines $ head args + let result = doGraphGen (map (stripReturn) list) + printf $ (show result) ++ "\n" -- cgit