summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-12-08 14:30:18 -0500
committerBen Gamari <ben@smart-cactus.org>2022-12-21 15:27:49 -0500
commit93ee7e9004c6acf01bf850a9be65c6cfe482e6f0 (patch)
tree227596e23bf87e1fa00c6844c575ed30be5e2c21
parentfb4d36c451218180ea40de7ec2c7b1209baf1dea (diff)
downloadhaskell-93ee7e9004c6acf01bf850a9be65c6cfe482e6f0.tar.gz
ghc-boot: Fix bootstrapping
-rw-r--r--libraries/ghc-boot/GHC/Utils/Encoding/UTF8.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/libraries/ghc-boot/GHC/Utils/Encoding/UTF8.hs b/libraries/ghc-boot/GHC/Utils/Encoding/UTF8.hs
index 91e7b381c9..5088e40dc2 100644
--- a/libraries/ghc-boot/GHC/Utils/Encoding/UTF8.hs
+++ b/libraries/ghc-boot/GHC/Utils/Encoding/UTF8.hs
@@ -44,17 +44,20 @@ module GHC.Utils.Encoding.UTF8
import Prelude
import Foreign
+import GHC.IO
+#if MIN_VERSION_base(4,18,0)
+import GHC.Encoding.UTF8
+#else
import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
import Data.Char
-import GHC.IO
+import GHC.Exts
import GHC.ST
+#endif
import Data.ByteString (ByteString)
import qualified Data.ByteString.Internal as BS
import Data.ByteString.Short.Internal (ShortByteString(..))
-import GHC.Exts
-
-- | Find the start of the codepoint preceding the codepoint at the given
-- 'Ptr'. This is undefined if there is no previous valid codepoint.
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)