summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Encoding.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-09-01 15:33:31 +0200
committerSebastian Graf <sebastian.graf@kit.edu>2020-09-01 15:33:31 +0200
commit8493e16ffce91bab1d7b7bb46583d30da6e10599 (patch)
treecfbd0a60ed4ef482a023c4fa30af180454bc1d2d /compiler/GHC/Utils/Encoding.hs
parent0300613c4f361e655c1c6ac7da3cefea3c6089b6 (diff)
downloadhaskell-wip/ftext-no-length.tar.gz
FastString: Remove cached length fieldwip/ftext-no-length
Diffstat (limited to 'compiler/GHC/Utils/Encoding.hs')
-rw-r--r--compiler/GHC/Utils/Encoding.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Utils/Encoding.hs b/compiler/GHC/Utils/Encoding.hs
index 24637a3bff..ac4d4e01e5 100644
--- a/compiler/GHC/Utils/Encoding.hs
+++ b/compiler/GHC/Utils/Encoding.hs
@@ -170,13 +170,13 @@ utf8DecodeShortByteString (SBS ba#)
let len# = sizeofByteArray# ba# in
utf8DecodeLazy# (return ()) (utf8DecodeCharByteArray# ba#) len#
-countUTF8Chars :: ShortByteString -> IO Int
+countUTF8Chars :: ShortByteString -> Int
countUTF8Chars (SBS ba) = go 0# 0#
where
len# = sizeofByteArray# ba
go i# n#
| isTrue# (i# >=# len#) =
- return (I# n#)
+ (I# n#)
| otherwise = do
case utf8DecodeCharByteArray# ba i# of
(# _, nBytes# #) -> go (i# +# nBytes#) (n# +# 1#)