diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2019-05-27 21:10:35 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-09 05:42:33 -0400 |
commit | f5e2fde47388fce5e23bf6f4abee0ae860a2e022 (patch) | |
tree | d66f68fabb6aa7f602263b5a96cc87466a99f262 /compiler/utils | |
parent | 4cf91d1abc0232ef6b85f44dfb2bb025ab0c70b0 (diff) | |
download | haskell-f5e2fde47388fce5e23bf6f4abee0ae860a2e022.tar.gz |
Update FastString docstrings
1) FastStrings are always UTF-8 encoded now.
2) Clarify what is meant by "hashed"
3) Add mention of lazy z-enc
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/FastString.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 662b6db79d..7749c3f7c3 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -171,20 +171,22 @@ mkFastZStringString str = FastZString (BSC.pack str) -- ----------------------------------------------------------------------------- -{-| -A 'FastString' is an array of bytes, hashed to support fast O(1) -comparison. It is also associated with a character encoding, so that -we know how to convert a 'FastString' to the local encoding, or to the -Z-encoding used by the compiler internally. +{-| A 'FastString' is a UTF-8 encoded string together with a unique ID. All +'FastString's are stored in a global hashtable to support fast O(1) +comparison. -'FastString's support a memoized conversion to the Z-encoding via zEncodeFS. +It is also associated with a lazy reference to the Z-encoding +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_bs :: {-# UNPACK #-} !ByteString, - fs_zenc :: FastZString -- lazily computed z-encoding of this string + fs_zenc :: FastZString + -- ^ Lazily computed z-encoding of this string. + -- + -- Since 'FastString's are globally memoized this is computed at most + -- once for any given string. } instance Eq FastString where |