From 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 17 Apr 2017 12:26:56 -0400 Subject: utils: Lazily decode UTF8 strings Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13527 Differential Revision: https://phabricator.haskell.org/D3442 --- compiler/utils/FastString.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'compiler/utils/FastString.hs') 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] -- cgit v1.2.1