diff --git a/src/Data/TreeDiff/Class.hs b/src/Data/TreeDiff/Class.hs
--- a/src/Data/TreeDiff/Class.hs
+++ b/src/Data/TreeDiff/Class.hs
@@ -602,7 +602,7 @@
 instance ToExpr Prim.ByteArray where
     toExpr ba = App "Prim.byteArrayFromList" [toExpr (Prim.foldrByteArray (:) [] ba :: [Word8])]
 
-#if MIN_VERSION_base(4,9,0)
+#if !MIN_VERSION_primitive(0,8,0) && MIN_VERSION_base(4,9,0)
 -- | @since 0.2.2
 instance ToExpr ByteArray where
     toExpr (ByteArray ba) = App "byteArrayFromList" [toExpr (Prim.foldrByteArray (:) [] (Prim.ByteArray ba) :: [Word8])]
diff --git a/tests/Tests.hs b/tests/Tests.hs
--- a/tests/Tests.hs
+++ b/tests/Tests.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP           #-}
 {-# LANGUAGE DeriveGeneric #-}
 module Main (main) where
 
@@ -11,7 +12,12 @@
 import Test.Tasty.Golden.Advanced (goldenTest)
 import Test.Tasty.QuickCheck      (testProperty)
 
+#if MIN_VERSION_base(4,9,0)
+import Data.Array.Byte (ByteArray (..))
+#endif
+
 import qualified Data.HashSet                 as HS
+import qualified Data.Primitive               as Prim
 import qualified Text.Parsec                  as P
 import qualified Text.PrettyPrint.ANSI.Leijen as WL
 import qualified Text.Trifecta                as T (eof, parseString)
@@ -151,6 +157,16 @@
 instance ToExpr MyInt3
 instance ToExpr Positional
 instance ToExpr Empty
+
+-- test that we have both instances.
+data ByteArrays = ByteArrays
+    Prim.ByteArray
+#if MIN_VERSION_base(4,9,0)
+    ByteArray
+#endif
+  deriving Generic
+
+instance ToExpr ByteArrays
 
 goldenTests :: TestTree
 goldenTests = testGroup "Golden"
diff --git a/tree-diff.cabal b/tree-diff.cabal
--- a/tree-diff.cabal
+++ b/tree-diff.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.2
 name:               tree-diff
-version:            0.3
+version:            0.3.0.1
 synopsis:           Diffing of (expression) trees.
 category:           Data, Testing
 description:
@@ -53,10 +53,11 @@
      || ==8.4.4
      || ==8.6.5
      || ==8.8.4
-     || ==8.10.4
+     || ==8.10.7
      || ==9.0.2
-     || ==9.2.4
-     || ==9.4.1
+     || ==9.2.7
+     || ==9.4.4
+     || ==9.6.1
   , GHCJS ==8.4
 
 extra-source-files:
@@ -85,7 +86,7 @@
 
   -- GHC boot libraries
   build-depends:
-    , base        >=4.5       && <4.18
+    , base        >=4.5       && <4.19
     , bytestring  ^>=0.9.2.1  || ^>=0.10.0.2 || ^>=0.11.0.0
     , containers  ^>=0.4.2.1  || ^>=0.5.0.0  || ^>=0.6.0.1
     , deepseq     ^>=1.3.0.0  || ^>=1.4.0.0
@@ -98,17 +99,17 @@
     , aeson                 ^>=1.4.6.0    || ^>=1.5.6.0  || ^>=2.0.0.0 || ^>=2.1.0.0
     , ansi-terminal         >=0.10        && <0.12
     , ansi-wl-pprint        ^>=0.6.8.2
-    , base-compat           >=0.10.5      && <0.11       || >=0.11.0   && <0.13
+    , base-compat           >=0           && <0.13       || ^>=0.13
     , bytestring-builder    ^>=0.10.8.2.0
     , hashable              ^>=1.2.7.0    || ^>=1.3.0.0  || ^>=1.4.0.1
     , parsers               ^>=0.12.10
-    , primitive             ^>=0.7.1.0
+    , primitive             >=0.7.1.0     && <0.8        || ^>=0.8
     , QuickCheck            ^>=2.14.2
     , scientific            ^>=0.3.6.2
-    , semialign             ^>=1.2.0.1
-    , strict                ^>=0.4.0.1
+    , semialign             >=1.2.0.1     && <1.3        || ^>=1.3
+    , strict                >=0.4.0.1     && <0.5        || ^>=0.5
     , tagged                ^>=0.8.6
-    , these                 ^>=1.1.1.1
+    , these                 >=1.1.1.1     && <1.2        || ^>=1.2
     , unordered-containers  ^>=0.2.8.0
     , uuid-types            ^>=1.0.3
     , vector                ^>=0.12.0.0   || ^>=0.13.0.0
@@ -125,10 +126,10 @@
   if !impl(ghc >=7.10)
     build-depends:
       , nats          ^>=1.1.2
-      , transformers  ^>=0.3.0.0 || ^>=0.4.2.0 || ^>=0.5.2.0
+      , transformers  ^>=0.3.0.0 || ^>=0.4.2.0 || >=0.5.2.0 && <0.6 || ^>=0.6
       , void          ^>=0.7.3
 
-  if impl(ghc >= 8) && !impl(ghc >=9.4)
+  if (impl(ghc >=8) && !impl(ghc >=9.4))
     build-depends: data-array-byte >=0.1.0.1 && <0.2
 
   other-extensions:
@@ -165,6 +166,9 @@
     , tree-diff
     , unordered-containers
 
+  if (impl(ghc >=8) && !impl(ghc >=9.4))
+    build-depends: data-array-byte
+
   if impl(ghc <7.5)
     build-depends: ghc-prim
 
@@ -174,6 +178,7 @@
     , tasty-golden      ^>=2.3.1.1
     , tasty-quickcheck  ^>=0.10.1
     , trifecta          >=2        && <2.2
+
 
 benchmark tree-diff-bench
   default-language: Haskell2010
