From 3814841d7d3b77b3f033cb98c1c0a04ac39435d7 Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 5 Nov 2013 13:11:10 +0000 Subject: 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%. --- gf.cabal | 70 +++++++++++++++++++++++----------------------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) (limited to 'gf.cabal') diff --git a/gf.cabal b/gf.cabal index 22e50ae0a..3098d4d9c 100644 --- a/gf.cabal +++ b/gf.cabal @@ -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.Morphology + PGF.Paraphrase PGF.Parse + PGF.Probabilistic PGF.SortTop - PGF.Expr PGF.Type - PGF.Tree PGF.Tokenizer - PGF.Paraphrase PGF.TypeCheck - PGF.Binary - PGF.Morphology - PGF.VisualizeTree - PGF.Printer - PGF.Probabilistic 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 -- cgit v1.2.3