diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-09-29 12:40:31 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-02 05:21:07 -0400 |
commit | 8b3d98ff376355317c64763cf619b1c41281b0d9 (patch) | |
tree | e461bdaa81a7d1037abc239887876704bb30c30b /compiler/GHC/Types/Literal.hs | |
parent | 4bdafb48b40afd1eb185c1312302e5759f796472 (diff) | |
download | haskell-8b3d98ff376355317c64763cf619b1c41281b0d9.tar.gz |
Don't use FastString for UTF-8 encoding only
Diffstat (limited to 'compiler/GHC/Types/Literal.hs')
-rw-r--r-- | compiler/GHC/Types/Literal.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/Types/Literal.hs b/compiler/GHC/Types/Literal.hs index 4b6775cc58..7572b5a660 100644 --- a/compiler/GHC/Types/Literal.hs +++ b/compiler/GHC/Types/Literal.hs @@ -75,6 +75,7 @@ import GHC.Utils.Binary import GHC.Settings.Constants import GHC.Platform import GHC.Utils.Panic +import GHC.Utils.Encoding import Data.ByteString (ByteString) import Data.Int @@ -576,7 +577,8 @@ mkLitChar = LitChar -- e.g. some of the \"error\" functions in GHC.Err such as @GHC.Err.runtimeError@ mkLitString :: String -> Literal -- stored UTF-8 encoded -mkLitString s = LitString (bytesFS $ mkFastString s) +mkLitString [] = LitString mempty +mkLitString s = LitString (utf8EncodeString s) mkLitBigNat :: Integer -> Literal mkLitBigNat x = assertPpr (x >= 0) (integer x) |