summaryrefslogtreecommitdiff
path: root/src/GF/Compile/ModDeps.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-11-11 22:24:33 +0000
committeraarne <unknown>2005-11-11 22:24:33 +0000
commit00b435c839b12539a78e9d5040f94d2284d37c0b (patch)
tree1a74f03ecc42f53e034998fb29b0ab12256ae6e8 /src/GF/Compile/ModDeps.hs
parentc52e57411b79b543f626651783a5cf2306c916f7 (diff)
compilation of functors
Diffstat (limited to 'src/GF/Compile/ModDeps.hs')
-rw-r--r--src/GF/Compile/ModDeps.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/GF/Compile/ModDeps.hs b/src/GF/Compile/ModDeps.hs
index 287667ab5..d2d3cbe83 100644
--- a/src/GF/Compile/ModDeps.hs
+++ b/src/GF/Compile/ModDeps.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/04/21 16:21:40 $
--- > CVS $Author: bringert $
--- > CVS $Revision: 1.13 $
+-- > CVS $Date: 2005/11/11 23:24:34 $
+-- > CVS $Author: aarne $
+-- > CVS $Revision: 1.14 $
--
-- Check correctness of module dependencies. Incomplete.
--
@@ -120,13 +120,17 @@ openInterfaces ds m = do
let mods = iterFix (concatMap more) (more (m,undefined))
return $ [i | (i,MTInterface) <- mods]
--- | this function finds out what modules are really needed in the canoncal gr.
+-- | this function finds out what modules are really needed in the canonical gr.
-- its argument is typically a concrete module name
-requiredCanModules :: (Ord i, Show i) => MGrammar i f a -> i -> [i]
-requiredCanModules gr = nub . iterFix (concatMap more) . allExtends gr where
+requiredCanModules :: (Ord i, Show i) => Bool -> MGrammar i f a -> i -> [i]
+requiredCanModules isSingle gr c = nub $ filter notReuse ops ++ exts where
+ exts = allExtends gr c
+ ops = if isSingle
+ then map fst (modules gr)
+ else iterFix (concatMap more) $ exts
more i = errVal [] $ do
m <- lookupModMod gr i
- return $ extends m ++ [o | o <- map openedModule (opens m), notReuse o]
+ return $ extends m ++ [o | o <- map openedModule (opens m)]
notReuse i = errVal True $ do
m <- lookupModMod gr i
return $ isModRes m -- to exclude reused Cnc and Abs from required