From 021b5f06d3900fe2b10d5d3ccf6ac286a779ef16 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 19 Sep 2013 20:48:10 +0000 Subject: Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remain The fact that identifiers are represented as ByteStrings is now an internal implentation detail in module GF.Infra.Ident. Conversion between ByteString and identifiers is only needed in the lexer and the Binary instances. --- src/compiler/GF/Grammar/Grammar.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/compiler/GF/Grammar/Grammar.hs') diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index c59cd809e..2efec220b 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -74,7 +74,6 @@ import Data.Array.Unboxed import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.IntMap as IntMap -import qualified Data.ByteString.Char8 as BS import Text.PrettyPrint import System.FilePath import Control.Monad.Identity @@ -472,7 +471,7 @@ data TInfo = -- | record label data Label = - LIdent BS.ByteString + LIdent RawIdent | LVar Int deriving (Show, Eq, Ord) @@ -497,16 +496,15 @@ varLabel :: Int -> Label varLabel = LVar tupleLabel, linLabel :: Int -> Label -tupleLabel i = LIdent $! BS.pack ('p':show i) -linLabel i = LIdent $! BS.pack ('s':show i) +tupleLabel i = LIdent $! rawIdentS ('p':show i) +linLabel i = LIdent $! rawIdentS ('s':show i) theLinLabel :: Label -theLinLabel = LIdent (BS.singleton 's') +theLinLabel = LIdent (rawIdentS "s") ident2label :: Ident -> Label -ident2label c = LIdent (ident2bs c) +ident2label c = LIdent (ident2raw c) label2ident :: Label -> Ident label2ident (LIdent s) = identC s -label2ident (LVar i) = identC (BS.pack ('$':show i)) - +label2ident (LVar i) = identS ('$':show i) -- cgit v1.2.3