X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Futils%2FFastString.lhs;h=c6dac8ff428d083c2a38a73ec28bd0dd30862993;hp=055f921213faef0428df5f2732e0b126bb5f9425;hb=d0faaa6fa0cecd23c5670fd199e9206275313666;hpb=789690fc23a49aa3bcbc946992fd6340c90d8c10 diff --git a/compiler/utils/FastString.lhs b/compiler/utils/FastString.lhs index 055f921..c6dac8f 100644 --- a/compiler/utils/FastString.lhs +++ b/compiler/utils/FastString.lhs @@ -2,6 +2,7 @@ % (c) The University of Glasgow, 1997-2006 % \begin{code} +{-# LANGUAGE BangPatterns #-} {-# OPTIONS -fno-warn-unused-imports #-} -- XXX GHC 6.9 seems to be confused by unpackCString# being used only in -- a RULE @@ -93,21 +94,19 @@ import Encoding import FastTypes import FastFunctions import Panic +import Util -import Foreign +import Foreign hiding ( unsafePerformIO ) import Foreign.C import GHC.Exts import System.IO import System.IO.Unsafe ( unsafePerformIO ) +import Data.Data import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) import Data.Maybe ( isJust ) import Data.Char ( ord ) -#if __GLASGOW_HASKELL__ >= 611 import GHC.IO ( IO(..) ) -#else -import GHC.IOBase ( IO(..) ) -#endif import GHC.Ptr ( Ptr(..) ) #if defined(__GLASGOW_HASKELL__) @@ -133,7 +132,7 @@ data FastString = FastString { n_chars :: {-# UNPACK #-} !Int, -- number of chars buf :: {-# UNPACK #-} !(ForeignPtr Word8), enc :: FSEncoding - } + } deriving Typeable data FSEncoding -- including strings that don't need any encoding @@ -159,6 +158,12 @@ instance Ord FastString where instance Show FastString where show fs = show (unpackFS fs) +instance Data FastString where + -- don't traverse? + toConstr _ = abstractConstr "FastString" + gunfold _ _ = error "gunfold" + dataTypeOf _ = mkNoRepType "FastString" + cmpFS :: FastString -> FastString -> Ordering cmpFS (FastString u1 l1 _ buf1 _) (FastString u2 l2 _ buf2 _) = if u1 == u2 then EQ else