summaryrefslogtreecommitdiff
path: root/src/Grasp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Grasp')
-rw-r--r--src/Grasp/Interpreter.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs
index 19b9a0f..fe8b42a 100644
--- a/src/Grasp/Interpreter.hs
+++ b/src/Grasp/Interpreter.hs
@@ -3,6 +3,8 @@ module Grasp.Interpreter (
) where
+import Data.Graph.Inductive.Graph( Node, LNode, LEdge, (&) )
+import qualified Data.Graph.Inductive.Graph as Graph
import Grasp.Types
import Grasp.Parser
@@ -20,13 +22,16 @@ grasp g =
-reachable :: GraspProgram -> [LNode String]
+reachable :: GraspProgram -> [Node]
reachable g = []
garbageCollect :: GraspProgram -> GraspProgram
-garbageCollect g = g
+garbageCollect g =
+ let unreachable = (Graph.nodes g) \\ (reachable g)
+ in Graph.delNodes unreachable g
+