summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Command
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-11-05 13:11:10 +0000
committerhallgren <hallgren@chalmers.se>2013-11-05 13:11:10 +0000
commit3814841d7d3b77b3f033cb98c1c0a04ac39435d7 (patch)
tree1ad913a0a7ca870b7ec62db86afbc422cab97df1 /src/compiler/GF/Command
parent74357cdedf90178253d5d812931cb78a9bdf54aa (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')
-rw-r--r--src/compiler/GF/Command/Abstract.hs3
-rw-r--r--src/compiler/GF/Command/Commands.hs15
-rw-r--r--src/compiler/GF/Command/Importing.hs2
-rw-r--r--src/compiler/GF/Command/Interpreter.hs4
-rw-r--r--src/compiler/GF/Command/Parse.hs3
5 files changed, 11 insertions, 16 deletions
diff --git a/src/compiler/GF/Command/Abstract.hs b/src/compiler/GF/Command/Abstract.hs
index 5469f12ac..8b7b824f0 100644
--- a/src/compiler/GF/Command/Abstract.hs
+++ b/src/compiler/GF/Command/Abstract.hs
@@ -1,7 +1,6 @@
module GF.Command.Abstract where
-import PGF.CId(CId,mkCId)
-import PGF.Data(Expr)
+import PGF(CId,mkCId,Expr)
type Ident = String
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
diff --git a/src/compiler/GF/Command/Importing.hs b/src/compiler/GF/Command/Importing.hs
index ce06156e4..4697e8b64 100644
--- a/src/compiler/GF/Command/Importing.hs
+++ b/src/compiler/GF/Command/Importing.hs
@@ -12,7 +12,7 @@ import GF.Infra.UseIO
import GF.Infra.Option
import GF.Data.ErrM
-import Data.List (nubBy)
+--import Data.List (nubBy)
import System.FilePath
-- import a grammar in an environment where it extends an existing grammar
diff --git a/src/compiler/GF/Command/Interpreter.hs b/src/compiler/GF/Command/Interpreter.hs
index 78f243fff..f27ba47da 100644
--- a/src/compiler/GF/Command/Interpreter.hs
+++ b/src/compiler/GF/Command/Interpreter.hs
@@ -13,10 +13,8 @@ import GF.Command.Abstract
import GF.Command.Parse
import PGF
import PGF.Data
-import PGF.Morphology
-import GF.System.Signal
+--import PGF.Morphology
import GF.Infra.SIO
-import GF.Infra.Option
import Text.PrettyPrint
import Control.Monad(when)
diff --git a/src/compiler/GF/Command/Parse.hs b/src/compiler/GF/Command/Parse.hs
index d68a0bcd7..855fdb54e 100644
--- a/src/compiler/GF/Command/Parse.hs
+++ b/src/compiler/GF/Command/Parse.hs
@@ -1,7 +1,6 @@
module GF.Command.Parse(readCommandLine, pCommand) where
-import PGF.CId
-import PGF.Expr
+import PGF
import GF.Command.Abstract
import Data.Char