Make Ident abstract; imports of Data.ByteString.Char8 down from 29 to 16 modules

Most of the explicit uses of ByteStrings were eliminated by using identS,

	identS = identC . BS.pack 

which was found in GF.Grammar.CF and moved to GF.Infra.Ident. The function

	prefixIdent :: String -> Ident -> Ident

allowed one additional import of ByteString to be eliminated. The functions

	isArgIdent :: Ident -> Bool
	getArgIndex :: Ident -> Maybe Int

were needed to eliminate explicit pattern matching on Ident from two modules.
This commit is contained in:
hallgren
2013-09-19 18:23:47 +00:00
parent c08f42ce9f
commit 3d5b9bd1fd
18 changed files with 101 additions and 237 deletions

View File

@@ -10,7 +10,7 @@ import GF.Compile
import GF.Compile.Export
import GF.Grammar.CF ---- should this be on a deeper level? AR 15/10/2008
import GF.Grammar (identC)
import GF.Infra.Ident(identS)
import GF.Infra.UseIO
import GF.Infra.Option
@@ -21,7 +21,6 @@ import Data.Binary
import qualified Data.Map as Map
import qualified Data.ByteString as BSS
import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Char8 as BS
import System.FilePath
import System.IO
import Control.Exception
@@ -49,7 +48,7 @@ compileSourceFiles opts fs =
let cnc = justModuleName (last fs)
if flag optStopAfterPhase opts == Compile
then return ()
else do pgf <- link opts (identC (BS.pack cnc)) gr
else do pgf <- link opts (identS cnc) gr
writePGF opts pgf
writeByteCode opts pgf
writeOutputs opts pgf
@@ -62,7 +61,7 @@ compileCFFiles opts fs =
gr <- compileSourceGrammar opts gf
if flag optStopAfterPhase opts == Compile
then return ()
else do pgf <- link opts (identC (BS.pack cnc)) gr
else do pgf <- link opts (identS cnc) gr
writePGF opts pgf
writeOutputs opts pgf