@@ -1,4 +1,4 @@
1−module Initialize (buildFromSource, getSortedModuleNames, Interfaces) where
1+module Initialize (buildFromSource, getSortedDependencies) where
22
33import Data.Data
44import Control.Monad.State
@@ -56,11 +56,11 @@ buildFromSource noPrelude interfaces source =
5656 return $ metaModule { types = types, exports = exports' }
5757
5858
59−getSortedModuleNames :: Bool -> FilePath -> IO [String]
60−getSortedModuleNames noPrelude root =
59+getSortedDependencies :: Bool -> FilePath -> IO [String]
60+getSortedDependencies noPrelude root =
6161 sortDeps =<< readDeps noPrelude root
6262
63−type Deps = (String, [String])
63+type Deps = (FilePath, String, [String])
6464
6565sortDeps :: [Deps] -> IO [String]
6666sortDeps depends =
@@ -68,8 +68,7 @@ sortDeps depends =
6868 then return (concat sccs)
6969 else print msg >> mapM print mistakes >> exitFailure
7070 where
71− graph = map (\(name, deps) -> (toFilePath name, name, deps)) depends
72− sccs = map Graph.flattenSCC $ Graph.stronglyConnComp graph
71+ sccs = map Graph.flattenSCC $ Graph.stronglyConnComp depends
7372
7473 mistakes = filter (\scc -> length scc > 1) sccs
7574 msg = "A cyclical module dependency or was detected in: "
@@ -93,7 +92,7 @@ readDeps noPrelude root = evalStateT (go root) Set.empty
9392 newDeps = Set.difference (Set.filter (not . isNative) realDeps) seen
9493 put (Set.insert name (Set.union newDeps seen))
9594 rest <- mapM (go . toFilePath) (Set.toList newDeps)
96− return ((name, Set.toList realDeps) : concat rest)
95+ return ((makeRelative "." root, name, Set.toList realDeps) : concat rest)
9796
9897
9998isNative name = List.isPrefixOf "Native." name