diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-04-17 12:26:56 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-04-17 20:34:40 -0400 |
commit | 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1 (patch) | |
tree | dae54e5e992c487cc9d2d1a2ea435ef25952c826 /compiler/utils/FastString.hs | |
parent | 3d3975f2f4caf3af76a7ea27d2882ddaee7db3c9 (diff) | |
download | haskell-1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1.tar.gz |
utils: Lazily decode UTF8 strings
Reviewers: austin, hvr
Subscribers: rwbarton, thomie
GHC Trac Issues: #13527
Differential Revision: https://phabricator.haskell.org/D3442
Diffstat (limited to 'compiler/utils/FastString.hs')
-rw-r--r-- | compiler/utils/FastString.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 8d1bbb5c67..8653485e0c 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -485,9 +485,7 @@ nullFS f = BS.null (fs_bs f) -- | Unpacks and decodes the FastString unpackFS :: FastString -> String -unpackFS (FastString _ _ bs _) = - inlinePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> - utf8DecodeString (castPtr ptr) len +unpackFS (FastString _ _ bs _) = utf8DecodeByteString bs -- | Gives the UTF-8 encoded bytes corresponding to a 'FastString' bytesFS :: FastString -> [Word8] |