diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2020-03-19 00:34:08 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-07-22 20:18:11 -0400 |
commit | 5976a1614e3da7d77f624103bb67f602738e93b8 (patch) | |
tree | 15e19b8cb90a0515d5d29da8fa0214ca8312d5e2 /compiler/GHC/Utils | |
parent | 5b8902e3975b8275b027b3d1cfe0d8cb8fdd3d13 (diff) | |
download | haskell-5976a1614e3da7d77f624103bb67f602738e93b8.tar.gz |
Encoding: Reformat utf8EncodeShortByteString to be more consistent
Diffstat (limited to 'compiler/GHC/Utils')
-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 |