summaryrefslogtreecommitdiff
path: root/compiler/GHC/Data/FastString.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Data/FastString.hs')
-rw-r--r--compiler/GHC/Data/FastString.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs
index 9ed0a38df3..3c52de1fae 100644
--- a/compiler/GHC/Data/FastString.hs
+++ b/compiler/GHC/Data/FastString.hs
@@ -89,6 +89,7 @@ module GHC.Data.FastString
isUnderscoreFS,
lexicalCompareFS,
uniqCompareFS,
+ headByteFS,
-- ** Outputting
hPutFS,
@@ -609,6 +610,10 @@ headFS fs
| SBS.null $ fs_sbs fs = panic "headFS: Empty FastString"
headFS fs = head $ unpackFS fs
+-- the first byte of the Modified UTF-8 encoded string
+headByteFS :: FastString -> Word8
+headByteFS fs = SBS.index (fs_sbs fs) 0
+
consFS :: Char -> FastString -> FastString
consFS c fs = mkFastString (c : unpackFS fs)