diff --git a/CHANGES.md b/CHANGES.md
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,22 @@
+## [v0.4.1.2](https://github.com/diagrams/diagrams-haddock/tree/v0.4.1.2) (2023-07-10)
+
+- Update upper bounds to allow:
+    - `base-4.17` and `base-4.18`
+    - `mtl-2.3`
+    - `bytestring-0.12`
+    - `strict-0.5`
+    - `lens-5.2`
+    - `linear-1.22`
+    - `text-2.0`
+    - `ansi-terminal-1.0`
+    - `Cabal-3.10`
+- Test on GHC 9.4 and 9.6
+
 ## [v0.4.1.1](https://github.com/diagrams/diagrams-haddock/tree/v0.4.1.1) (2021-11-09)
 
 - Allow `Cabal-3.6`
+
+- r1: allow `base-4.16` and `lens-5.1`; test with GHC 9.2
 
 ## [v0.4.1](https://github.com/diagrams/diagrams-haddock/tree/v0.4.1) (2021-08-12)
 
diff --git a/diagrams-haddock.cabal b/diagrams-haddock.cabal
--- a/diagrams-haddock.cabal
+++ b/diagrams-haddock.cabal
@@ -1,5 +1,5 @@
 name:                diagrams-haddock
-version:             0.4.1.1
+version:             0.4.1.2
 synopsis:            Preprocessor for embedding diagrams in Haddock documentation
 description:         diagrams-haddock is a tool for compiling embedded inline
                      diagrams code in Haddock documentation, for an
@@ -24,9 +24,9 @@
 category:            Graphics
 build-type:          Simple
 cabal-version:       1.18
-extra-source-files:  README.md, CHANGES.md, diagrams/*.svg
-extra-doc-files:     diagrams/*.svg
-tested-with:         GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.4 || ==9.0.1
+extra-source-files:  README.md, diagrams/*.svg
+extra-doc-files:     diagrams/*.svg, CHANGES.md
+tested-with:         GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.1
 
 Source-repository head
   type: git
@@ -35,28 +35,28 @@
 library
   exposed-modules:     Diagrams.Haddock
   other-modules:       Paths_diagrams_haddock
-  build-depends:       base >= 4.4 && < 4.16,
-                       filepath,
-                       directory,
-                       mtl >= 2.0 && < 2.3,
+  build-depends:       base >= 4.4 && < 4.19,
+                       filepath >= 1.4 && < 1.5,
+                       directory >= 1.3 && < 1.4,
+                       mtl >= 2.0 && < 2.4,
                        containers >= 0.4 && < 0.7,
                        split >= 0.2 && < 0.3,
-                       bytestring >= 0.9 && < 0.12,
-                       strict >= 0.3 && < 0.5,
-                       parsec >= 3,
+                       bytestring >= 0.9 && < 0.13,
+                       strict >= 0.3 && < 0.6,
+                       parsec >= 3 && < 3.2,
                        haskell-src-exts >= 1.18 && < 1.24,
                        svg-builder >= 0.1 && < 0.2,
                        diagrams-builder >= 0.5 && < 0.9,
                        diagrams-lib >= 1.4 && < 1.5,
                        diagrams-svg >= 1.4 && < 1.5,
-                       lens >= 3.8 && < 5.1,
-                       linear >= 1.10 && < 1.22,
-                       cpphs >= 1.15,
+                       lens >= 3.8 && < 5.3,
+                       linear >= 1.10 && < 1.23,
+                       cpphs >= 1.15 && < 1.21,
                        unliftio >= 0.2.12 && < 0.3,
                        uniplate >= 1.6 && < 1.7,
-                       text >= 0.11 && < 1.3,
+                       text >= 0.11 && < 2.1,
                        base64-bytestring >= 1 && < 1.3,
-                       ansi-terminal >= 0.5 && < 0.12
+                       ansi-terminal >= 0.5 && < 1.1
   hs-source-dirs:      src
   other-extensions:    TemplateHaskell
   default-language:    Haskell2010
@@ -64,12 +64,12 @@
 Executable diagrams-haddock
   main-is:             diagrams-haddock.hs
   other-modules:       Paths_diagrams_haddock
-  build-depends:       base,
-                       directory,
-                       filepath,
+  build-depends:       base >= 4.4 && < 4.19,
+                       directory >= 1.3 && < 1.4,
+                       filepath >= 1.4 && < 1.5,
                        diagrams-haddock,
                        cmdargs >= 0.8 && < 0.11,
-                       Cabal >= 2.2 && < 3.7,
+                       Cabal >= 2.2 && < 3.11,
                        cpphs >= 1.15
   hs-source-dirs:      tools
   default-language:    Haskell2010
@@ -82,8 +82,8 @@
                        QuickCheck >= 2.4 && < 2.15,
                        tasty >= 0.8 && < 1.5,
                        tasty-quickcheck >= 0.8 && < 0.11,
-                       parsec >= 3,
-                       lens >= 3.8 && < 5.1,
+                       parsec >= 3 && < 3.2,
+                       lens >= 3.8 && < 5.3,
                        haskell-src-exts >= 1.18 && < 1.24,
                        diagrams-haddock
   hs-source-dirs:      test
diff --git a/src/Diagrams/Haddock.hs b/src/Diagrams/Haddock.hs
--- a/src/Diagrams/Haddock.hs
+++ b/src/Diagrams/Haddock.hs
@@ -76,6 +76,7 @@
 import           Control.Arrow               (first, (&&&), (***))
 import           Control.Lens                (makeLenses, orOf, view, (%%~),
                                               (%~), (&), (.~), (^.), _2, _Right)
+import           Control.Monad               (when)
 import           Control.Monad.Writer
 import qualified Data.ByteString.Base64.Lazy as BS64
 import qualified Data.ByteString.Lazy        as BS
