diff options
-rw-r--r-- | compiler/GHC/Utils/Encoding.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Utils/Encoding.hs b/compiler/GHC/Utils/Encoding.hs index 51ebc20ead..24637a3bff 100644 --- a/compiler/GHC/Utils/Encoding.hs +++ b/compiler/GHC/Utils/Encoding.hs @@ -221,13 +221,13 @@ utf8EncodeString (Ptr a#) str = go a# str go (a# `plusAddr#` off#) cs utf8EncodeShortByteString :: String -> IO ShortByteString - let !(I# len#) = utf8EncodedLength str in - case newByteArray# len# s of { (# s, mba# #) -> - let ST f_go = go mba# 0# str in - case f_go s of { (# s, () #) -> utf8EncodeShortByteString str = IO $ \s -> + case utf8EncodedLength str of { I# len# -> + case newByteArray# len# s of { (# s, mba# #) -> + case go mba# 0# str of { ST f_go -> + case f_go s of { (# s, () #) -> case unsafeFreezeByteArray# mba# s of { (# s, ba# #) -> - (# s, SBS ba# #) }}} + (# s, SBS ba# #) }}}}} where go _ _ [] = return () go mba# i# (c:cs) = do |