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

@@ -57,7 +57,7 @@ flag custom-binary
Description: Use a customised version of the binary package
Default: True
library
Library
build-depends: base >= 4.2 && <5,
array,
fst,
@@ -66,11 +66,11 @@ library
random,
pretty,
mtl
hs-source-dirs: src/compiler src/runtime/haskell
hs-source-dirs: src/runtime/haskell
if flag(custom-binary)
hs-source-dirs: src/binary
other-modules:
exposed-modules:
-- not really part of GF but I have changed the original binary library
-- and we have to keep the copy for now.
Data.Binary
@@ -81,40 +81,38 @@ library
else
build-depends: binary
ghc-options: -fwarn-unused-imports
extensions:
exposed-modules:
PGF
other-modules:
PGF.CId
PGF.Data
PGF.Macros
PGF.Optimize
PGF.Printer
PGF.Signature
PGF.Tree
PGF.Utilities
other-modules:
PGF.CId
PGF.Binary
PGF.Expr
PGF.Generate
PGF.Linearize
PGF.Parse
PGF.SortTop
PGF.Expr
PGF.Type
PGF.Tree
PGF.Tokenizer
PGF.Paraphrase
PGF.TypeCheck
PGF.Binary
PGF.Morphology
PGF.VisualizeTree
PGF.Printer
PGF.Paraphrase
PGF.Parse
PGF.Probabilistic
PGF.SortTop
PGF.Type
PGF.Tokenizer
PGF.TypeCheck
PGF.Forest
PGF.Optimize
PGF.Signature
GF.Data.TrieMap
GF.Data.Utilities
GF.Data.SortedList
GF.Data.ErrM
GF.Data.Relation
GF.Data.Operations
PGF.TrieMap
PGF.VisualizeTree
executable gf
build-depends: base >= 4.2 && <5,
Executable gf
build-depends: gf,
base >= 4.2 && <5,
array,
containers,
bytestring,
@@ -131,7 +129,7 @@ executable gf
haskeline,
parallel>=3,
utf8-string
ghc-options: -threaded
ghc-options: -threaded -fwarn-unused-imports
if flag(server)
build-depends: httpd-shed, network, json, cgi
-- ,silently
@@ -153,21 +151,17 @@ executable gf
if impl(ghc>=7.0)
ghc-options: -rtsopts
hs-source-dirs: src/compiler src/runtime/haskell
hs-source-dirs: src/compiler
if flag(custom-binary)
hs-source-dirs: src/binary
other-modules: Data.Binary.IEEE754
else
if !flag(custom-binary)
build-depends: binary, data-binary-ieee754
extensions:
main-is: GF.hs
other-modules:
GF.Data.BacktrackM
GF.Data.TrieMap
GF.Data.Utilities
GF.Data.SortedList
-- GF.Data.SortedList
GF.Data.ErrM
GF.Data.Operations
GF.Data.Str
@@ -227,20 +221,6 @@ executable gf
GF.Compile
GF.Index
GF.Quiz
PGF
PGF.CId
PGF.Data
PGF.Expr
PGF.Type
PGF.Tree
PGF.Macros
PGF.Generate
PGF.Linearize
PGF.Binary
PGF.Paraphrase
PGF.TypeCheck
PGF.Printer
PGF.Optimize
GFC
GFI