summaryrefslogtreecommitdiff
path: root/ghc/compiler/utils
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-03-30 16:24:05 +0000
committersimonmar <unknown>2005-03-30 16:24:05 +0000
commit6720aae478aeffab9d93b33b76e8718130cd4a7b (patch)
tree2076b6118f0b51e7abce735da561c6fd39148c8a /ghc/compiler/utils
parent34bfc56e5f2c5374bcc4f67fbd0692f0c14fe029 (diff)
downloadhaskell-6720aae478aeffab9d93b33b76e8718130cd4a7b.tar.gz
[project @ 2005-03-30 16:24:04 by simonmar]
Add support for partial reloads in the GHC API. This is mainly for VS: when editing a file you don't want to continually reload the entire project whenever the current file changes, you want to reload up to and including the current file only. However, you also want to retain any other modules in the session that are still stable. I added a variant of :reload in GHCi to test this. You can say ':reload M' to reload up to module M only. This will bring M up to date, and throw away any invalidated modules from the session.
Diffstat (limited to 'ghc/compiler/utils')
-rw-r--r--ghc/compiler/utils/Digraph.lhs16
1 files changed, 12 insertions, 4 deletions
diff --git a/ghc/compiler/utils/Digraph.lhs b/ghc/compiler/utils/Digraph.lhs
index 0eff6da698..c49087c8f3 100644
--- a/ghc/compiler/utils/Digraph.lhs
+++ b/ghc/compiler/utils/Digraph.lhs
@@ -5,7 +5,8 @@ module Digraph(
stronglyConnComp, stronglyConnCompR, SCC(..), flattenSCC, flattenSCCs,
Graph, Vertex,
- graphFromEdges, buildG, transposeG, reverseE, outdegree, indegree,
+ graphFromEdges, graphFromEdges',
+ buildG, transposeG, reverseE, outdegree, indegree,
Tree(..), Forest,
showTree, showForest,
@@ -154,12 +155,19 @@ indegree = outdegree . transposeG
\begin{code}
-graphFromEdges
+graphFromEdges
:: Ord key
=> [(node, key, [key])]
-> (Graph, Vertex -> (node, key, [key]))
-graphFromEdges edges
- = (graph, \v -> vertex_map ! v)
+graphFromEdges edges =
+ case graphFromEdges' edges of (graph, vertex_fn, _) -> (graph, vertex_fn)
+
+graphFromEdges'
+ :: Ord key
+ => [(node, key, [key])]
+ -> (Graph, Vertex -> (node, key, [key]), key -> Maybe Vertex)
+graphFromEdges' edges
+ = (graph, \v -> vertex_map ! v, key_vertex)
where
max_v = length edges - 1
bounds = (0,max_v) :: (Vertex, Vertex)