diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+### 1.3.2.7
+
+_2026-10-20 Andreas Abel_
+
+- Replace `memcpy` foreign imports with `copyMutableByteArray#` (David Himmelstrup [#78](https://github.com/haskell-hvr/regex-tdfa/issues/78))
+- Tested with GHC 8.0 - 10.0.1 alpha1
+
 ### 1.3.2.6
 
 _2026-08-13 Andreas Abel_
diff --git a/lib/Text/Regex/TDFA/NewDFA/Engine.hs b/lib/Text/Regex/TDFA/NewDFA/Engine.hs
--- a/lib/Text/Regex/TDFA/NewDFA/Engine.hs
+++ b/lib/Text/Regex/TDFA/NewDFA/Engine.hs
@@ -16,8 +16,7 @@
 -- #ifdef __GLASGOW_HASKELL__
 import GHC.Arr(STArray(..))
 import GHC.ST(ST(..))
-import GHC.Exts(MutableByteArray#,RealWorld,Int#,getSizeofMutableByteArray#,State#)
-import Unsafe.Coerce (unsafeCoerce)
+import GHC.Exts(getSizeofMutableByteArray#,copyMutableByteArray#)
 {-
 -- #else
 import Control.Monad.ST(ST)
@@ -47,7 +46,6 @@
 import qualified Data.ByteString.Lazy.Char8 as LBS(ByteString)
 import qualified Data.Text as T
 import qualified Data.Text.Lazy as TL
-import Foreign.Ptr(Ptr)
 
 import Text.Regex.Base(MatchArray,MatchOffset,MatchLength)
 import qualified Text.Regex.TDFA.IntArrTrieSet as Trie(lookupAsc)
@@ -708,14 +706,7 @@
   set (m_orbit s2) i2 $! newOrbit
   newerPos !! 0
 
-{- USING memcpy TO COPY STUARRAY DATA -}
-
--- #ifdef __GLASGOW_HASKELL__
-foreign import ccall unsafe "memcpy"
-    memcpyIO :: MutableByteArray# RealWorld -> MutableByteArray# RealWorld -> Int# -> IO (Ptr a)
-
-memcpyST :: MutableByteArray# s -> MutableByteArray# s -> Int# -> State# s -> (# State# s, Ptr a #)
-memcpyST = unsafeCoerce memcpyIO
+-- Copy STUArray storage through the byte-array primitive.
 
 {-
 Prelude Data.Array.Base> :i STUArray
@@ -732,7 +723,7 @@
 --  when (b1/=b2) (error ("\n\nWTF copySTU: "++show (b1,b2)))
   ST $ \s1# ->
     case getSizeofMutableByteArray# msource s1# of { (# s1'#, n# #) ->
-    case memcpyST mdest msource n# s1'# of { (# s2#, _ #) ->
+    case copyMutableByteArray# msource 0# mdest 0# n# s1'# of { s2# ->
     (# s2#, () #) }}
 {-
 -- #else /* !__GLASGOW_HASKELL__ */
diff --git a/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs b/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
--- a/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
+++ b/lib/Text/Regex/TDFA/NewDFA/Engine_FA.hs
@@ -17,7 +17,7 @@
 
 import GHC.Arr(STArray(..))
 import GHC.ST(ST(..))
-import GHC.Exts(MutableByteArray#,RealWorld,Int#,getSizeofMutableByteArray#,unsafeCoerce#,State#)
+import GHC.Exts(getSizeofMutableByteArray#,copyMutableByteArray#)
 
 import Prelude hiding ((!!))
 import Control.Monad(when,unless,forM,forM_,liftM2,foldM)
@@ -39,7 +39,6 @@
 import qualified Data.Sequence as Seq(null)
 import qualified Data.ByteString.Char8 as SBS(ByteString)
 import qualified Data.ByteString.Lazy.Char8 as LBS(ByteString)
-import Foreign.Ptr(Ptr)
 
 import Text.Regex.Base(MatchArray,MatchOffset,MatchLength)
 import Text.Regex.TDFA.Common hiding (indent)
@@ -599,14 +598,7 @@
   doActions preTag newerPos (newPos instructions)
   set (m_orbit s2) i2 $! newOrbit
 
-{- USING memcpy TO COPY STUARRAY DATA -}
-
--- #ifdef __GLASGOW_HASKELL__
-foreign import ccall unsafe "memcpy"
-    memcpyIO :: MutableByteArray# RealWorld -> MutableByteArray# RealWorld -> Int# -> IO (Ptr a)
-
-memcpyST :: MutableByteArray# s -> MutableByteArray# s -> Int# -> State# s -> (# State# s, Ptr a #)
-memcpyST = unsafeCoerce# memcpyIO
+-- Copy STUArray storage through the byte-array primitive.
 
 {-
 Prelude Data.Array.Base> :i STUArray
@@ -623,7 +615,7 @@
 --  when (b1/=b2) (error ("\n\nWTF copySTU: "++show (b1,b2)))
   ST $ \s1# ->
     case getSizeofMutableByteArray# msource s1# of { (# s1'#, n# #) ->
-    case memcpyST mdest msource n# s1'# of { (# s2#, _ #) ->
+    case copyMutableByteArray# msource 0# mdest 0# n# s1'# of { s2# ->
     (# s2#, () #) }}
 {-
 -- #else /* !__GLASGOW_HASKELL__ */
diff --git a/regex-tdfa.cabal b/regex-tdfa.cabal
--- a/regex-tdfa.cabal
+++ b/regex-tdfa.cabal
@@ -1,6 +1,6 @@
 cabal-version:          2.0
 name:                   regex-tdfa
-version:                1.3.2.6
+version:                1.3.2.7
 
 build-Type:             Simple
 license:                BSD3
@@ -27,6 +27,7 @@
   test/cases/*.txt
 
 tested-with:
+  GHC == 10.0.1
   GHC == 9.14.1
   GHC == 9.12.4
   GHC == 9.10.3
@@ -39,8 +40,6 @@
   GHC == 8.8.4
   GHC == 8.6.5
   GHC == 8.4.4
-  GHC == 8.2.2
-  GHC == 8.0.2
 
 source-repository head
   type:                git
@@ -49,7 +48,7 @@
 source-repository this
   type:                git
   location:            https://github.com/haskell-hvr/regex-tdfa.git
-  tag:                 v1.3.2.6
+  tag:                 v1.3.2.7
 
 flag force-O2
   default: False
