1
0
forked from GitHub/gf-core

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%.
This commit is contained in:
hallgren
2013-11-05 13:11:10 +00:00
parent e6ec23c178
commit decd7122de
97 changed files with 312 additions and 335 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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