-- show list of all goals(i.e. prints their name)
cShowDgGoals :: CmdlState -> IO CmdlState
cShowDgGoals state
 = case i_state $ intState state of
    -- nothing to print
    Nothing -> return state
    Just dgState -> let
         -- list of all nodes
         ls = getAllNodes dgState
         -- compute list of node goals
         nodeGoals = nodeNames $ filter (hasOpenGoals . snd) ls
         -- list of all goal edge names
         edgeGoals = map fst $ filter (edgeContainsGoals . snd)
           $ createEdgeNames ls $ getAllEdges dgState
     -- print sorted version of the list
      in return $ genMessage [] (unlines $ sort (nodeGoals ++ edgeGoals)) state


{- local function that computes the theory of a node but it
   keeps only the goal theory -}
cShowDgGoals :: CmdlState -> IO CmdlState
cShowDgGoals state
 = case i_state $ intState state of
    -- nothing to print
    Nothing -> return state
    Just dgState -> let
         -- list of all nodes
         ls = getAllNodes dgState
         -- compute list of node goals
         nodeGoals = nodeNames $ filter (hasOpenGoals . snd) ls
         -- list of all goal edge names
         edgeGoals = map fst $ filter (edgeContainsGoals . snd)
           $ createEdgeNames ls $ getAllEdges dgState
     -- print sorted version of the list
      in return $ genMessage [] (unlines $ sort (nodeGoals ++ edgeGoals)) state


{- local function that computes the theory of a node but it
   keeps only the goal theory -}
cShowDgGoals state
 = case i_state $ intState state of
    -- nothing to print
    Nothing -> return state
    Just dgState -> let
         -- list of all nodes
         ls = getAllNodes dgState
         -- compute list of node goals
         nodeGoals = nodeNames $ filter (hasOpenGoals . snd) ls
         -- list of all goal edge names
         edgeGoals = map fst $ filter (edgeContainsGoals . snd)
           $ createEdgeNames ls $ getAllEdges dgState
     -- print sorted version of the list
      in return $ genMessage [] (unlines $ sort (nodeGoals ++ edgeGoals)) state


{- local function that computes the theory of a node but it
   keeps only the goal theory -}