From d6252d1c16d59ad26db0d08a531cddf39864d9db Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 12 Jun 2014 14:43:18 +0000 Subject: [PATCH] PGF library: expose only PGF and PGF.Internal instead of all modules PGF exports the public, stable API. PGF.Internal exports additional things needed in the GF compiler & shell, including the nonstardard version of Data.Binary. --- gf.cabal | 9 +++++---- src/compiler/GF/Command/Commands.hs | 10 +++++----- src/compiler/GF/Command/Importing.hs | 3 +-- src/compiler/GF/Command/Interpreter.hs | 2 +- src/compiler/GF/Command/TreeOperations.hs | 2 +- src/compiler/GF/Compile.hs | 2 +- src/compiler/GF/Compile/CFGtoPGF.hs | 4 +--- src/compiler/GF/Compile/Compute/Value.hs | 2 +- src/compiler/GF/Compile/Export.hs | 2 +- src/compiler/GF/Compile/GenerateBC.hs | 4 ++-- src/compiler/GF/Compile/GeneratePMCFG.hs | 11 +++++------ src/compiler/GF/Compile/GrammarToPGF.hs | 8 ++++---- src/compiler/GF/Compile/Instructions.hs | 5 +---- src/compiler/GF/Compile/PGFtoHaskell.hs | 3 +-- src/compiler/GF/Compile/PGFtoJS.hs | 5 ++--- src/compiler/GF/Compile/PGFtoLProlog.hs | 2 +- src/compiler/GF/Compile/PGFtoProlog.hs | 2 +- src/compiler/GF/Compile/PGFtoPython.hs | 3 +-- src/compiler/GF/Compile/ToAPI.hs | 2 +- src/compiler/GF/Grammar/Binary.hs | 4 ++-- src/compiler/GF/Grammar/Grammar.hs | 2 +- src/compiler/GF/Grammar/Printer.hs | 3 +-- src/compiler/GF/Infra/Ident.hs | 2 +- src/compiler/GF/Infra/Option.hs | 2 +- src/compiler/GF/Speech/CFGToFA.hs | 3 +-- src/compiler/GF/Speech/JSGF.hs | 3 +-- src/compiler/GF/Speech/PGFToCFG.hs | 3 +-- src/compiler/GF/Speech/VoiceXML.hs | 3 +-- src/compiler/GFC.hs | 9 +++------ src/compiler/GFI.hs | 3 +-- src/compiler/SimpleEditor/Convert.hs | 2 +- src/runtime/haskell-bind/PGF2.hsc | 9 +++++++++ src/runtime/haskell/PGF/Internal.hs | 18 ++++++++++++++++++ src/runtime/haskell/PGF/Utilities.hs | 4 ++-- 34 files changed, 80 insertions(+), 71 deletions(-) create mode 100644 src/runtime/haskell/PGF/Internal.hs diff --git a/gf.cabal b/gf.cabal index 4d7b401a6..8c10e78a4 100644 --- a/gf.cabal +++ b/gf.cabal @@ -76,7 +76,7 @@ Library if flag(custom-binary) hs-source-dirs: src/binary - exposed-modules: + other-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 @@ -95,14 +95,15 @@ Library exposed-modules: PGF + PGF.Internal + PGF.Lexing + PGF.Utilities + other-modules: PGF.Data PGF.Macros PGF.Binary PGF.Optimize PGF.Printer - PGF.Utilities - PGF.Lexing - other-modules: PGF.CId PGF.Expr PGF.Generate diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index cf08499be..b6a992232 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -14,14 +14,14 @@ import Prelude hiding (putStrLn) import PGF -import PGF.Macros(lookStartCat,functionsToCat,lookValCat,restrictPGF,hasLin) -import PGF.Data(abstract,funs,cats,Literal(LStr),Expr(EFun,ELit)) ---- +import PGF.Internal(lookStartCat,functionsToCat,lookValCat,restrictPGF,hasLin) +import PGF.Internal(abstract,funs,cats,Literal(LStr),Expr(EFun,ELit)) ---- --import PGF.Morphology(isInMorpho,morphoKnown) -import PGF.Printer(ppFun,ppCat) +import PGF.Internal(ppFun,ppCat) --import PGF.Probabilistic(rankTreesByProbs,probTree,setProbabilities) --import PGF.Generate (generateRandomFrom) ---- --import PGF.Tree (Tree(Fun), expr2tree, tree2expr) -import PGF.Optimize(optimizePGF) +import PGF.Internal(optimizePGF) import GF.Compile.Export import GF.Compile.ToAPI @@ -41,7 +41,7 @@ import GF.Command.TreeOperations ---- temporary place for typecheck and compute import GF.Data.Operations -import Data.Binary (encodeFile) +import PGF.Internal (encodeFile) import Data.List(intersperse,nub) import Data.Maybe import qualified Data.Map as Map diff --git a/src/compiler/GF/Command/Importing.hs b/src/compiler/GF/Command/Importing.hs index 3cf7674a0..4c5d796c5 100644 --- a/src/compiler/GF/Command/Importing.hs +++ b/src/compiler/GF/Command/Importing.hs @@ -1,8 +1,7 @@ module GF.Command.Importing (importGrammar, importSource) where import PGF -import PGF.Data -import PGF.Optimize +import PGF.Internal(optimizePGF,unionPGF,msgUnionPGF) import GF.Compile import GF.Compile.Multi (readMulti) diff --git a/src/compiler/GF/Command/Interpreter.hs b/src/compiler/GF/Command/Interpreter.hs index f27ba47da..001c18554 100644 --- a/src/compiler/GF/Command/Interpreter.hs +++ b/src/compiler/GF/Command/Interpreter.hs @@ -12,7 +12,7 @@ import GF.Command.Commands import GF.Command.Abstract import GF.Command.Parse import PGF -import PGF.Data +import PGF.Internal --import PGF.Morphology import GF.Infra.SIO diff --git a/src/compiler/GF/Command/TreeOperations.hs b/src/compiler/GF/Command/TreeOperations.hs index 220c8f561..b06da6cff 100644 --- a/src/compiler/GF/Command/TreeOperations.hs +++ b/src/compiler/GF/Command/TreeOperations.hs @@ -5,7 +5,7 @@ module GF.Command.TreeOperations ( ) where import PGF -import PGF.Data +import PGF.Internal(Expr(..),unAppForm) import Data.List type TreeOp = [Expr] -> [Expr] diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs index 962a63815..6cebd2196 100644 --- a/src/compiler/GF/Compile.hs +++ b/src/compiler/GF/Compile.hs @@ -34,7 +34,7 @@ import Data.List(nub) import Data.Time(UTCTime) import Text.PrettyPrint -import PGF.Optimize +import PGF.Internal(optimizePGF) import PGF -- | Compiles a number of source files and builds a 'PGF' structure for them. diff --git a/src/compiler/GF/Compile/CFGtoPGF.hs b/src/compiler/GF/Compile/CFGtoPGF.hs index e1eaf53b2..96fc13554 100644 --- a/src/compiler/GF/Compile/CFGtoPGF.hs +++ b/src/compiler/GF/Compile/CFGtoPGF.hs @@ -4,9 +4,7 @@ import GF.Grammar.CFG import GF.Infra.UseIO import PGF -import PGF.Data -import PGF.Macros -import PGF.Optimize +import PGF.Internal import qualified Data.Set as Set import qualified Data.Map as Map diff --git a/src/compiler/GF/Compile/Compute/Value.hs b/src/compiler/GF/Compile/Compute/Value.hs index 8f47ad184..64683a3de 100644 --- a/src/compiler/GF/Compile/Compute/Value.hs +++ b/src/compiler/GF/Compile/Compute/Value.hs @@ -1,6 +1,6 @@ module GF.Compile.Compute.Value where import GF.Grammar.Grammar(Label,Type,MetaId,Patt,QIdent) -import PGF.Data(BindType) +import PGF.Internal(BindType) import GF.Infra.Ident(Ident) import Text.Show.Functions() import Data.Ix(Ix) diff --git a/src/compiler/GF/Compile/Export.hs b/src/compiler/GF/Compile/Export.hs index 727a21f2d..ff7d5790a 100644 --- a/src/compiler/GF/Compile/Export.hs +++ b/src/compiler/GF/Compile/Export.hs @@ -1,7 +1,7 @@ module GF.Compile.Export where import PGF -import PGF.Printer(ppPGF) +import PGF.Internal(ppPGF) import GF.Compile.PGFtoHaskell import GF.Compile.PGFtoProlog import GF.Compile.PGFtoLProlog diff --git a/src/compiler/GF/Compile/GenerateBC.hs b/src/compiler/GF/Compile/GenerateBC.hs index 26d48380f..61605e3f8 100644 --- a/src/compiler/GF/Compile/GenerateBC.hs +++ b/src/compiler/GF/Compile/GenerateBC.hs @@ -2,13 +2,13 @@ module GF.Compile.GenerateBC(generateByteCode) where import GF.Grammar import GF.Compile.Instructions -import PGF.Data +import PGF.Internal(Binary(..),encode,BCAddr) import Data.Maybe import qualified Data.IntMap as IntMap import qualified Data.ByteString as BSS import qualified Data.ByteString.Lazy as BS -import Data.Binary +import PGF.Internal() generateByteCode :: [(QIdent,Info)] -> ([(QIdent,Info,BCAddr)], BSS.ByteString) generateByteCode = runGenM . mapM genFun diff --git a/src/compiler/GF/Compile/GeneratePMCFG.hs b/src/compiler/GF/Compile/GeneratePMCFG.hs index 5a3f01c86..fb51f9be9 100644 --- a/src/compiler/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/GF/Compile/GeneratePMCFG.hs @@ -14,7 +14,7 @@ module GF.Compile.GeneratePMCFG ) where --import PGF.CId -import PGF.Data(CncCat(..),Symbol(..),fidVar) +import PGF.Internal as PGF(CncCat(..),Symbol(..),fidVar) import GF.Infra.Option import GF.Grammar hiding (Env, mkRecord, mkTable) @@ -194,13 +194,12 @@ unfactor t = CM (\gr c -> c (unfac gr t)) Vr y | y == x -> u _ -> composSafeOp (restore x u) t -pgfCncCat :: SourceGrammar -> Type -> Int -> PGF.Data.CncCat +pgfCncCat :: SourceGrammar -> Type -> Int -> CncCat pgfCncCat gr lincat index = let ((_,size),schema) = computeCatRange gr lincat - in PGF.Data.CncCat index - (index+size-1) - (mkArray (map (renderStyle style{mode=OneLineMode} . ppPath) - (getStrPaths schema))) + in PGF.CncCat index (index+size-1) + (mkArray (map (renderStyle style{mode=OneLineMode} . ppPath) + (getStrPaths schema))) where getStrPaths :: Schema Identity s c -> [Path] getStrPaths = collect CNil [] diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs index 5917b709c..b72bbb347 100644 --- a/src/compiler/GF/Compile/GrammarToPGF.hs +++ b/src/compiler/GF/Compile/GrammarToPGF.hs @@ -6,11 +6,11 @@ import GF.Compile.GeneratePMCFG import GF.Compile.GenerateBC import PGF(CId,mkCId,utf8CId) -import PGF.Data(fidInt,fidFloat,fidString,fidVar) -import PGF.Optimize(updateProductionIndices) +import PGF.Internal(fidInt,fidFloat,fidString,fidVar) +import PGF.Internal(updateProductionIndices) --import qualified PGF.Macros as CM -import qualified PGF.Data as C -import qualified PGF.Data as D +import qualified PGF.Internal as C +import qualified PGF.Internal as D import GF.Grammar.Predef --import GF.Grammar.Printer import GF.Grammar.Grammar diff --git a/src/compiler/GF/Compile/Instructions.hs b/src/compiler/GF/Compile/Instructions.hs index 586671a4d..138fabe97 100644 --- a/src/compiler/GF/Compile/Instructions.hs +++ b/src/compiler/GF/Compile/Instructions.hs @@ -1,10 +1,7 @@ module GF.Compile.Instructions where --import Data.IORef -import Data.Binary -import Data.Binary.Put -import Data.Binary.Get -import Data.Binary.IEEE754 +import PGF.Internal -- Binary import PGF(CId) --import PGF.CId --import PGF.Binary diff --git a/src/compiler/GF/Compile/PGFtoHaskell.hs b/src/compiler/GF/Compile/PGFtoHaskell.hs index 17c9bb2f5..9a921f645 100644 --- a/src/compiler/GF/Compile/PGFtoHaskell.hs +++ b/src/compiler/GF/Compile/PGFtoHaskell.hs @@ -17,8 +17,7 @@ module GF.Compile.PGFtoHaskell (grammar2haskell) where import PGF(showCId) -import PGF.Data -import PGF.Macros +import PGF.Internal import GF.Data.Operations import GF.Infra.Option diff --git a/src/compiler/GF/Compile/PGFtoJS.hs b/src/compiler/GF/Compile/PGFtoJS.hs index 707739025..534b00812 100644 --- a/src/compiler/GF/Compile/PGFtoJS.hs +++ b/src/compiler/GF/Compile/PGFtoJS.hs @@ -1,8 +1,7 @@ module GF.Compile.PGFtoJS (pgf2js) where -import PGF(showCId) -import PGF.Data hiding (mkStr) -import qualified PGF.Macros as M +import PGF(CId,showCId) +import PGF.Internal as M import qualified GF.JavaScript.AbsJS as JS import qualified GF.JavaScript.PrintJS as JS diff --git a/src/compiler/GF/Compile/PGFtoLProlog.hs b/src/compiler/GF/Compile/PGFtoLProlog.hs index 61e28eb17..b0825b26c 100644 --- a/src/compiler/GF/Compile/PGFtoLProlog.hs +++ b/src/compiler/GF/Compile/PGFtoLProlog.hs @@ -1,7 +1,7 @@ module GF.Compile.PGFtoLProlog(grammar2lambdaprolog_mod, grammar2lambdaprolog_sig) where import PGF(mkCId,ppCId,showCId,wildCId) -import PGF.Data hiding (ppExpr, ppType, ppHypo) +import PGF.Internal hiding (ppExpr,ppType,ppHypo,ppCat,ppFun) --import PGF.Macros import Data.List import Data.Maybe diff --git a/src/compiler/GF/Compile/PGFtoProlog.hs b/src/compiler/GF/Compile/PGFtoProlog.hs index 8fffd5f07..25d1e6e41 100644 --- a/src/compiler/GF/Compile/PGFtoProlog.hs +++ b/src/compiler/GF/Compile/PGFtoProlog.hs @@ -9,7 +9,7 @@ module GF.Compile.PGFtoProlog (grammar2prolog) where import PGF(mkCId,wildCId,showCId) -import PGF.Data +import PGF.Internal --import PGF.Macros import GF.Data.Operations diff --git a/src/compiler/GF/Compile/PGFtoPython.hs b/src/compiler/GF/Compile/PGFtoPython.hs index 57ac92a79..a186509fe 100644 --- a/src/compiler/GF/Compile/PGFtoPython.hs +++ b/src/compiler/GF/Compile/PGFtoPython.hs @@ -9,8 +9,7 @@ module GF.Compile.PGFtoPython (pgf2python) where import PGF(showCId) -import PGF.Data -import qualified PGF.Macros as M +import PGF.Internal as M import GF.Data.Operations diff --git a/src/compiler/GF/Compile/ToAPI.hs b/src/compiler/GF/Compile/ToAPI.hs index a67abd1fb..d59ee4305 100644 --- a/src/compiler/GF/Compile/ToAPI.hs +++ b/src/compiler/GF/Compile/ToAPI.hs @@ -2,7 +2,7 @@ module GF.Compile.ToAPI (stringToAPI,exprToAPI) where -import PGF.Data +import PGF.Internal import PGF(showCId) import Data.Maybe --import System.IO diff --git a/src/compiler/GF/Grammar/Binary.hs b/src/compiler/GF/Grammar/Binary.hs index 7b4540ce5..ad9df8b92 100644 --- a/src/compiler/GF/Grammar/Binary.hs +++ b/src/compiler/GF/Grammar/Binary.hs @@ -13,7 +13,7 @@ import Prelude hiding (catch) import Control.Exception(catch,ErrorCall(..),throwIO) --import Data.Char -import Data.Binary +import PGF.Internal(Binary(..),Word8,putWord8,getWord8,encodeFile,decodeFile) --import Control.Monad import qualified Data.Map as Map import qualified Data.ByteString.Char8 as BS @@ -24,7 +24,7 @@ import GF.Infra.Option import GF.Grammar.Grammar import PGF() -- Binary instances -import PGF.Data(Literal(..)) +import PGF.Internal(Literal(..)) -- Please change this every time when the GFO format is changed gfoVersion = "GF03" diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index 2fdab29c7..df60c7c54 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -66,7 +66,7 @@ import GF.Infra.Option --- import GF.Data.Operations -import PGF.Data (FId, FunId, SeqId, LIndex, Sequence, BindType(..)) +import PGF.Internal (FId, FunId, SeqId, LIndex, Sequence, BindType(..)) --import Data.List import Data.Array.IArray diff --git a/src/compiler/GF/Grammar/Printer.hs b/src/compiler/GF/Grammar/Printer.hs index 14a87b45a..6138f2ab9 100644 --- a/src/compiler/GF/Grammar/Printer.hs +++ b/src/compiler/GF/Grammar/Printer.hs @@ -29,8 +29,7 @@ import GF.Infra.Option import GF.Grammar.Values import GF.Grammar.Grammar -import PGF.Data (ppMeta, ppLit) -import PGF.Printer (ppFId, ppFunId, ppSeqId, ppSeq) +import PGF.Internal (ppMeta, ppLit, ppFId, ppFunId, ppSeqId, ppSeq) import Text.PrettyPrint import Data.Maybe (isNothing) diff --git a/src/compiler/GF/Infra/Ident.hs b/src/compiler/GF/Infra/Ident.hs index a5874b744..390c5ba84 100644 --- a/src/compiler/GF/Infra/Ident.hs +++ b/src/compiler/GF/Infra/Ident.hs @@ -30,7 +30,7 @@ import qualified Data.ByteString.Char8 as BS(append,isPrefixOf) -- Limit use of BS functions to the ones that work correctly on -- UTF-8-encoded bytestrings! import Data.Char(isDigit) -import Data.Binary(Binary(..)) +import PGF.Internal(Binary(..)) import Text.PrettyPrint(Doc,text) diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs index 7a7f77a1e..80606c0a9 100644 --- a/src/compiler/GF/Infra/Option.hs +++ b/src/compiler/GF/Infra/Option.hs @@ -43,7 +43,7 @@ import GF.Data.Operations(Err,ErrorMonad(..),liftErr) import Data.Set (Set) import qualified Data.Set as Set -import PGF.Data(Literal(..)) +import PGF.Internal(Literal(..)) usageHeader :: String usageHeader = unlines diff --git a/src/compiler/GF/Speech/CFGToFA.hs b/src/compiler/GF/Speech/CFGToFA.hs index 330c763e5..5319c0bbe 100644 --- a/src/compiler/GF/Speech/CFGToFA.hs +++ b/src/compiler/GF/Speech/CFGToFA.hs @@ -14,8 +14,7 @@ import qualified Data.Map as Map import Data.Set (Set) import qualified Data.Set as Set ---import PGF.CId -import PGF.Data +import PGF.Internal import GF.Data.Utilities import GF.Grammar.CFG --import GF.Speech.PGFToCFG diff --git a/src/compiler/GF/Speech/JSGF.hs b/src/compiler/GF/Speech/JSGF.hs index 6a4935a7f..2f4b4d96d 100644 --- a/src/compiler/GF/Speech/JSGF.hs +++ b/src/compiler/GF/Speech/JSGF.hs @@ -18,8 +18,7 @@ import GF.Grammar.CFG import GF.Speech.RegExp import GF.Speech.SISR import GF.Speech.SRG ---import PGF.CId -import PGF.Data +import PGF import Data.Char import Data.List diff --git a/src/compiler/GF/Speech/PGFToCFG.hs b/src/compiler/GF/Speech/PGFToCFG.hs index d70a74fe7..49744f22e 100644 --- a/src/compiler/GF/Speech/PGFToCFG.hs +++ b/src/compiler/GF/Speech/PGFToCFG.hs @@ -7,8 +7,7 @@ module GF.Speech.PGFToCFG (bnfPrinter, pgfToCFG) where import PGF(showCId) -import PGF.Data as PGF -import PGF.Macros +import PGF.Internal as PGF --import GF.Infra.Ident import GF.Grammar.CFG hiding (Symbol) diff --git a/src/compiler/GF/Speech/VoiceXML.hs b/src/compiler/GF/Speech/VoiceXML.hs index 3703fe7a2..764278694 100644 --- a/src/compiler/GF/Speech/VoiceXML.hs +++ b/src/compiler/GF/Speech/VoiceXML.hs @@ -12,8 +12,7 @@ module GF.Speech.VoiceXML (grammar2vxml) where import GF.Data.XML --import GF.Infra.Ident import PGF -import PGF.Data -import PGF.Macros +import PGF.Internal --import Control.Monad (liftM) import Data.List (intersperse) -- isPrefixOf, find diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index b9ad7051a..66c0ccd91 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -2,10 +2,8 @@ module GFC (mainGFC, writePGF) where -- module Main where import PGF ---import PGF.CId -import PGF.Data -import PGF.Optimize -import PGF.Binary(putSplitAbs) +import PGF.Internal(PGF(..),code,funs,cats,optimizePGF,unionPGF) +import PGF.Internal(putSplitAbs) import GF.Compile import GF.Compile.Export import GF.Compile.CFGtoPGF @@ -19,8 +17,7 @@ import GF.Data.ErrM import GF.System.Directory import Data.Maybe -import Data.Binary(encode,encodeFile) -import Data.Binary.Put(runPut) +import PGF.Internal(encode,encodeFile,runPut) import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.ByteString as BSS diff --git a/src/compiler/GFI.hs b/src/compiler/GFI.hs index eb1afd22a..4d7e65870 100644 --- a/src/compiler/GFI.hs +++ b/src/compiler/GFI.hs @@ -29,8 +29,7 @@ import qualified System.Console.Haskeline as Haskeline --import GF.Compile.Coding(codeTerm) import PGF -import PGF.Data -import PGF.Macros +import PGF.Internal(emptyPGF,abstract,funs,lookStartCat) import Data.Char import Data.List(nub,isPrefixOf,isInfixOf,partition) diff --git a/src/compiler/SimpleEditor/Convert.hs b/src/compiler/SimpleEditor/Convert.hs index 686bdba3b..0f07bc8bf 100644 --- a/src/compiler/SimpleEditor/Convert.hs +++ b/src/compiler/SimpleEditor/Convert.hs @@ -17,7 +17,7 @@ import GF.Grammar.Printer(ppParams,ppTerm,getAbs,TermPrintQual(..)) import GF.Grammar.Parser(runP,pModDef) import GF.Grammar.Lexer(Posn(..)) import GF.Data.ErrM -import PGF.Data(Literal(LStr)) +import PGF.Internal(Literal(LStr)) import SimpleEditor.Syntax as S import SimpleEditor.JSON diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index d76e86a5d..56f7c0c13 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -1,4 +1,13 @@ {-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-} +------------------------------------------------- +-- | +-- Maintainer : Krasimir Angelov +-- Stability : stable +-- Portability : portable +-- +-- This is the Haskell binding to the C run-time system for +-- loading and interpreting grammars compiled in Portable Grammar Format (PGF). +------------------------------------------------- #include #include #include diff --git a/src/runtime/haskell/PGF/Internal.hs b/src/runtime/haskell/PGF/Internal.hs new file mode 100644 index 000000000..f2c79596c --- /dev/null +++ b/src/runtime/haskell/PGF/Internal.hs @@ -0,0 +1,18 @@ +{-# OPTIONS_HADDOCK hide #-} +------------------------------------------------- +-- | +-- Stability : unstable +-- +------------------------------------------------- +module PGF.Internal(module Internal) where +import PGF.Binary as Internal +import PGF.Data as Internal +import PGF.Macros as Internal +import PGF.Optimize as Internal +import PGF.Printer as Internal +import PGF.Utilities as Internal + +import Data.Binary as Internal +import Data.Binary.Get as Internal +import Data.Binary.IEEE754 as Internal +import Data.Binary.Put as Internal diff --git a/src/runtime/haskell/PGF/Utilities.hs b/src/runtime/haskell/PGF/Utilities.hs index 5af5b9b5d..ab1b4e2fe 100644 --- a/src/runtime/haskell/PGF/Utilities.hs +++ b/src/runtime/haskell/PGF/Utilities.hs @@ -3,10 +3,10 @@ module PGF.Utilities where import Data.Set(empty,member,insert) --- | Like 'nub', but O(n log n) instead of O(n^2), since it uses a set to lookup previous things. +-- | Like 'Data.List.nub', but O(n log n) instead of O(n^2), since it uses a set to lookup previous things. -- The result list is stable (the elements are returned in the order they occur), and lazy. -- Requires that the list elements can be compared by Ord. --- Code ruthlessly taken from http://hpaste.org/54411 +-- Code ruthlessly taken from nub' :: Ord a => [a] -> [a] nub' = loop empty where loop _ [] = []