@@ -141,6 +141,18 @@ addToCG n cg
141 = do i <- getIState
141 = do i <- getIState
142 putIState $ i { idris_callgraph = addDef n cg (idris_callgraph i) }
142 putIState $ i { idris_callgraph = addDef n cg (idris_callgraph i) }
144+-- Trace all the names in a call graph starting at the given name
145+getAllNames :: Name -> Idris [Name]
146+getAllNames n = allNames [] n
148+allNames :: [Name] -> Name -> Idris [Name]
149+allNames ns n | n `elem` ns = return []
150+allNames ns n = do i <- getIState
151+ case lookupCtxtExact n (idris_callgraph i) of
152+ [ns'] -> do more <- mapM (allNames (n:ns)) (map fst (calls ns'))
153+ return (nub (n : concat more))
144addCoercion :: Name -> Idris ()
156addCoercion :: Name -> Idris ()
145addCoercion n = do i <- getIState
157addCoercion n = do i <- getIState
146 putIState $ i { idris_coercions = nub $ n : idris_coercions i }
158 putIState $ i { idris_coercions = nub $ n : idris_coercions i }