diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Revision history for construct
 
+## 0.3.1 -- 2022-03-25
+
+* Increment the text dependency upper bound
+* Move the Template Haskell splices tso they compile with GHC 9
+
 ## 0.3.0.2 -- 2021-03-22
 
 * Increment the attoparsec dependency upper bounds
diff --git a/construct.cabal b/construct.cabal
--- a/construct.cabal
+++ b/construct.cabal
@@ -1,6 +1,6 @@
 cabal-version:       >=1.10
 name:                construct
-version:             0.3.0.2
+version:             0.3.1
 synopsis:            Haskell version of the Construct library for easy specification of file formats
 description:
    A Haskell version of the <https://construct.readthedocs.io/en/latest/intro.html Construct> library for Python. A
@@ -30,7 +30,7 @@
   other-modules:       Construct.Internal
   build-depends:       base >=4.11 && <5,
                        bytestring >= 0.10 && < 0.12,
-                       text >= 0.10 && < 1.3,
+                       text >= 0.10 && < 2.1,
                        monoid-subclasses >= 1.0 && < 1.2,
                        incremental-parser >= 0.5 && < 0.6,
                        parsers >= 0.11 && < 0.13,
@@ -58,7 +58,7 @@
   type:                exitcode-stdio-1.0
   hs-source-dirs:      test
   build-depends:       base >=4.9 && < 5, construct,
-                       bytestring < 0.12, text < 1.3, cereal, rank2classes >= 1.0.2 && < 1.5,
+                       bytestring < 0.12, text, cereal, rank2classes >= 1.0.2 && < 1.5,
                        monoid-subclasses >= 1.0 && < 1.2, incremental-parser < 0.6, attoparsec >= 0.12 && < 0.15,
                        directory < 2, filepath < 1.5,
                        tasty >= 0.7, tasty-hunit
diff --git a/test/MBR.hs b/test/MBR.hs
--- a/test/MBR.hs
+++ b/test/MBR.hs
@@ -53,6 +53,10 @@
 deriving instance Show (Partition Identity)
 deriving instance Show (Position Identity)
 
+$(Rank2.TH.deriveAll ''MasterBootRecord)
+$(Rank2.TH.deriveAll ''Partition)
+$(Rank2.TH.deriveAll ''Position)
+
 format :: Format (Parser ByteString) Maybe ByteString (MasterBootRecord Identity)
 format = record MasterBootRecord{
    bootLoaderCode = count 446 byte,
@@ -85,7 +89,3 @@
    head = littleEndianBitsOf byte,
    sector = count 6 bit,
    cylinder = count 10 bit}
-
-$(Rank2.TH.deriveAll ''MasterBootRecord)
-$(Rank2.TH.deriveAll ''Partition)
-$(Rank2.TH.deriveAll ''Position)
diff --git a/test/TAR.hs b/test/TAR.hs
--- a/test/TAR.hs
+++ b/test/TAR.hs
@@ -67,6 +67,11 @@
 deriving instance Show (FileHeader Word32 Identity)
 deriving instance Show (UStarHeader Identity)
 
+$(Rank2.TH.deriveAll ''Archive)
+$(Rank2.TH.deriveAll ''File)
+$(Rank2.TH.deriveAll ''FileHeader)
+$(Rank2.TH.deriveAll ''UStarHeader)
+
 archive :: Format Parser Maybe ByteString (Archive Identity)
 archive = record Archive{files= many file}
 
@@ -140,8 +145,3 @@
 sumOf header = ByteString.foldl' add 0 (fold $ serialize blankFormat header)
    where add s b = s + fromIntegral b
          blankFormat = record (fileHeaderRecord $ literal $ ASCII.replicate 8 ' ')
-
-$(Rank2.TH.deriveAll ''Archive)
-$(Rank2.TH.deriveAll ''File)
-$(Rank2.TH.deriveAll ''FileHeader)
-$(Rank2.TH.deriveAll ''UStarHeader)
diff --git a/test/URI.hs b/test/URI.hs
--- a/test/URI.hs
+++ b/test/URI.hs
@@ -52,6 +52,9 @@
 deriving instance Show t => Show (UriReference t Identity)
 deriving instance Show t => Show (Authority t Identity)
 
+$(Rank2.TH.deriveAll ''UriReference)
+$(Rank2.TH.deriveAll ''Authority)
+
 uriReference :: Format Parser Maybe ByteString (UriReference ByteString Identity)
 uriReference = record UriReference{
    scheme = optional (uriScheme <* literal ":"),
@@ -151,6 +154,3 @@
          hexChar = chr . fst . head . readHex
          padLeft [c] = ['0', c]
          padLeft cs = cs
-
-$(Rank2.TH.deriveAll ''UriReference)
-$(Rank2.TH.deriveAll ''Authority)
diff --git a/test/WMF.hs b/test/WMF.hs
--- a/test/WMF.hs
+++ b/test/WMF.hs
@@ -136,6 +136,10 @@
               | TextOut
               deriving (Eq, Ord, Show)
 
+$(Rank2.TH.deriveAll ''File)
+$(Rank2.TH.deriveAll ''PlaceableHeader)
+$(Rank2.TH.deriveAll ''Record)
+
 fileFormat :: Format (Parser ByteString) Maybe ByteString (File Identity)
 fileFormat = record File{
    placeableHeader = optional headerFormat,
@@ -250,7 +254,3 @@
    params = count (fromIntegral (recordSize this) - 3) (cereal' getWord16le putWord16le)
    }
    where word16le = value (cereal' getWord16le putWord16le)
-
-$(Rank2.TH.deriveAll ''File)
-$(Rank2.TH.deriveAll ''PlaceableHeader)
-$(Rank2.TH.deriveAll ''Record)
