diff options
| author | hallgren <hallgren@chalmers.se> | 2013-11-05 13:11:10 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-11-05 13:11:10 +0000 |
| commit | 3814841d7d3b77b3f033cb98c1c0a04ac39435d7 (patch) | |
| tree | 1ad913a0a7ca870b7ec62db86afbc422cab97df1 /src/compiler/GF/Command/Commands.hs | |
| parent | 74357cdedf90178253d5d812931cb78a9bdf54aa (diff) | |
Eliminate mutual dependencies between the GF compiler and the PGF library
+ References to modules under src/compiler have been eliminated from the PGF
library (under src/runtime/haskell). Only two functions had to be moved (from
GF.Data.Utilities to PGF.Utilities) to make this possible, other apparent
dependencies turned out to be vacuous.
+ In gf.cabal, the GF executable no longer directly depends on the PGF library
source directory, but only on the exposed library modules. This means that
there is less duplication in gf.cabal and that the 30 modules in the
PGF library will no longer be compiled twice while building GF.
To make this possible, additional PGF library modules have been exposed, even
though they should probably be considered for internal use only. They could
be collected in a PGF.Internal module, or marked as "unstable", to make
this explicit.
+ Also, by using the -fwarn-unused-imports flag, ~220 redundant imports were
found and removed, reducing the total number of imports by ~15%.
Diffstat (limited to 'src/compiler/GF/Command/Commands.hs')
| -rw-r--r-- | src/compiler/GF/Command/Commands.hs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 8a19d2729..a05b3cf20 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -14,13 +14,12 @@ import Prelude hiding (putStrLn) import PGF -import PGF.VisualizeTree(getDepLabels) import PGF.Macros(lookStartCat,functionsToCat,lookValCat,restrictPGF,hasLin) import PGF.Data(abstract,funs,cats,Literal(LStr),Expr(EFun,ELit)) ---- -import PGF.Morphology(isInMorpho,morphoKnown) +--import PGF.Morphology(isInMorpho,morphoKnown) import PGF.Printer(ppFun,ppCat) -import PGF.Probabilistic(rankTreesByProbs,probTree,setProbabilities) -import PGF.Generate (generateRandomFrom) ---- +--import PGF.Probabilistic(rankTreesByProbs,probTree,setProbabilities) +--import PGF.Generate (generateRandomFrom) ---- import PGF.Tree (Tree(Fun), expr2tree, tree2expr) import PGF.Optimize(optimizePGF) @@ -30,7 +29,7 @@ import GF.Compile.ExampleBased import GF.Infra.Option (noOptions, readOutputFormat, outputFormatsExpl) import GF.Infra.UseIO(writeUTF8File) import GF.Infra.SIO -import GF.Data.ErrM ---- +--import GF.Data.ErrM ---- import GF.Command.Abstract import GF.Command.Messages import GF.Text.Lexing @@ -43,13 +42,13 @@ import GF.Command.TreeOperations ---- temporary place for typecheck and compute import GF.Data.Operations import Data.Binary (encodeFile) -import Data.List +import Data.List(intersperse,nub) import Data.Maybe import qualified Data.Map as Map --import System.Cmd(system) -- use GF.Infra.UseIO.restricedSystem instead! import Text.PrettyPrint import Data.List (sort) -import Debug.Trace +--import Debug.Trace --import System.Random (newStdGen) ---- @@ -940,7 +939,7 @@ allCommands = Map.fromList [ let outp = valStrOpts "output" "dot" opts mlab <- case file of "" -> return Nothing - _ -> restricted (readFile file) >>= return . Just . getDepLabels . lines + _ -> (Just . getDepLabels . lines) `fmap` restricted (readFile file) let lang = optLang pgf opts let grphs = unlines $ map (graphvizDependencyTree outp debug mlab Nothing pgf lang) es if isFlag "view" opts || isFlag "format" opts then do |
