@@ -77,13 +77,17 @@ forwardChain deps
7777-- Build the dependency graph,
7878-- starting the depth-first search from a list of Names.
7979buildDepMap :: Context -> [Name] -> Deps
80−buildDepMap ctx ns = addMain $ dfs S.empty M.empty ns
80+buildDepMap ctx ns = addPostulates $ dfs S.empty M.empty ns
8181 where
8282 -- mark the result of Main.main as used with the empty assumption
83− addMain :: Deps -> Deps
84− addMain = M.insertWith S.union S.empty $ S.singleton (main, Result)
83+ addPostulates :: Deps -> Deps
84+ addPostulates deps = foldr (\(ds, rs) -> M.insertWith S.union ds rs) deps postulates
8585 where
86− main = NS (UN $ pack "main") [pack "Main"]
86+ (==>) ds rs = (S.fromList ds, S.fromList rs)
87+ (.:) ms n = NS (UN $ pack n) (map pack ms)
88+ postulates =
89+ [ [] ==> [(["Main"] .: "main", Result)]
90+ ]
8791
8892 -- perform depth-first search
8993 -- to discover all the names used in the program