diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2020-09-01 15:33:31 +0200 |
---|---|---|
committer | Sebastian Graf <sebastian.graf@kit.edu> | 2020-09-01 15:33:31 +0200 |
commit | 8493e16ffce91bab1d7b7bb46583d30da6e10599 (patch) | |
tree | cfbd0a60ed4ef482a023c4fa30af180454bc1d2d /compiler/GHC/Data/FastString.hs | |
parent | 0300613c4f361e655c1c6ac7da3cefea3c6089b6 (diff) | |
download | haskell-wip/ftext-no-length.tar.gz |
FastString: Remove cached length fieldwip/ftext-no-length
Diffstat (limited to 'compiler/GHC/Data/FastString.hs')
-rw-r--r-- | compiler/GHC/Data/FastString.hs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs index fbd69d426f..ff56557794 100644 --- a/compiler/GHC/Data/FastString.hs +++ b/compiler/GHC/Data/FastString.hs @@ -184,7 +184,6 @@ of this string which is used by the compiler internally. -} data FastString = FastString { uniq :: {-# UNPACK #-} !Int, -- unique id - n_chars :: {-# UNPACK #-} !Int, -- number of chars fs_sbs :: {-# UNPACK #-} !ShortByteString, fs_zenc :: FastZString -- ^ Lazily computed z-encoding of this string. @@ -499,8 +498,7 @@ mkNewFastStringShortByteString :: ShortByteString -> Int -> IORef Int -> IO FastString mkNewFastStringShortByteString sbs uid n_zencs = do let zstr = mkZFastString n_zencs sbs - chars <- countUTF8Chars sbs - return (FastString uid chars sbs zstr) + return (FastString uid sbs zstr) hashStr :: ShortByteString -> Int -- produce a hash value between 0 & m (inclusive) @@ -525,7 +523,7 @@ hashStr sbs@(SBS.SBS ba#) = loop 0# 0# -- | Returns the length of the 'FastString' in characters lengthFS :: FastString -> Int -lengthFS fs = n_chars fs +lengthFS FastString{fs_sbs=sbs} = countUTF8Chars sbs -- | Returns @True@ if the 'FastString' is empty nullFS :: FastString -> Bool |