diff --git a/patches/vty-5.37.patch b/patches/vty-5.37.patch
new file mode 100644
index 0000000000000000000000000000000000000000..28e6e5178bf593beeac321f1740813377b84e55c
--- /dev/null
+++ b/patches/vty-5.37.patch
@@ -0,0 +1,270 @@
+diff --git a/src/Data/Terminfo/Eval.hs b/src/Data/Terminfo/Eval.hs
+index 86b10d8..c5ab1f0 100644
+--- a/src/Data/Terminfo/Eval.hs
++++ b/src/Data/Terminfo/Eval.hs
+@@ -14,9 +14,9 @@ import Blaze.ByteString.Builder.Word
+ import Blaze.ByteString.Builder
+ import Data.Terminfo.Parse
+ 
+-import Control.Monad.Identity
+-import Control.Monad.State.Strict
+-import Control.Monad.Writer
++import Control.Monad (forM_)
++import Control.Monad.State.Strict (MonadState(..), StateT(..))
++import Control.Monad.Writer (MonadWriter(..), Writer, runWriter)
+ 
+ import Data.Bits ((.|.), (.&.), xor)
+ import Data.List
+diff --git a/src/Graphics/Vty/Input/Focus.hs b/src/Graphics/Vty/Input/Focus.hs
+index bddb902..d58bad2 100644
+--- a/src/Graphics/Vty/Input/Focus.hs
++++ b/src/Graphics/Vty/Input/Focus.hs
+@@ -10,7 +10,7 @@ import Graphics.Vty.Input.Events
+ import Graphics.Vty.Input.Classify.Types
+ import Graphics.Vty.Input.Classify.Parse
+ 
+-import Control.Monad.State
++import Control.Monad (when)
+ 
+ import qualified Data.ByteString.Char8 as BS8
+ import Data.ByteString.Char8 (ByteString)
+diff --git a/src/Graphics/Vty/Input/Mouse.hs b/src/Graphics/Vty/Input/Mouse.hs
+index f4c80f1..b53d9c8 100644
+--- a/src/Graphics/Vty/Input/Mouse.hs
++++ b/src/Graphics/Vty/Input/Mouse.hs
+@@ -14,7 +14,7 @@ import Graphics.Vty.Input.Events
+ import Graphics.Vty.Input.Classify.Types
+ import Graphics.Vty.Input.Classify.Parse
+ 
+-import Control.Monad.State
++import Control.Monad (when)
+ import Data.Maybe (catMaybes)
+ import Data.Bits ((.&.))
+ 
+diff --git a/src/Graphics/Vty/PictureToSpans.hs b/src/Graphics/Vty/PictureToSpans.hs
+index df8a901..1d7affd 100644
+--- a/src/Graphics/Vty/PictureToSpans.hs
++++ b/src/Graphics/Vty/PictureToSpans.hs
+@@ -17,9 +17,11 @@ import Graphics.Vty.Span
+ import Lens.Micro
+ import Lens.Micro.Mtl
+ import Lens.Micro.TH
+-import Control.Monad.Reader
+-import Control.Monad.State.Strict hiding ( state )
++import Control.Monad (foldM, forM_, when)
++import Control.Monad.Reader (ReaderT(..))
++import Control.Monad.State.Strict (MonadState(get, put), StateT(..))
+ import Control.Monad.ST.Strict
++import Control.Monad.Trans.Class (MonadTrans(..))
+ 
+ import qualified Data.Vector as Vector hiding ( take, replicate )
+ import Data.Vector.Mutable ( MVector(..))
+diff --git a/test/VerifyOutput.hs b/test/VerifyOutput.hs
+index 2af1f85..a4688c3 100644
+--- a/test/VerifyOutput.hs
++++ b/test/VerifyOutput.hs
+@@ -1,6 +1,7 @@
+ -- We setup the environment to invoke certain terminals of interest.
+ -- This assumes appropriate definitions exist in the current environment
+ -- for the terminals of interest.
++{-# LANGUAGE CPP #-}
+ {-# LANGUAGE ScopedTypeVariables #-}
+ module VerifyOutput where
+ 
+@@ -34,7 +35,11 @@ smokeTestTermNonMac termName i = liftIOResult $ do
+ 
+ smokeTestTerm :: String -> Image -> IO Result
+ smokeTestTerm termName i = do
+-    nullOut <- openFd "/dev/null" WriteOnly Nothing defaultFileFlags
++    nullOut <- openFd "/dev/null" WriteOnly
++#if !(MIN_VERSION_unix(2,8,0))
++                      Nothing
++#endif
++                      defaultFileFlags
+     t <- outputForConfig $ defaultConfig
+         { outputFd = Just nullOut
+         , termName = Just termName
+diff --git a/vty.cabal b/vty.cabal
+index 732e2d4..b4b96ec 100644
+--- a/vty.cabal
++++ b/vty.cabal
+@@ -49,7 +49,7 @@ library
+                        microlens-mtl,
+                        microlens-th,
+                        hashable >= 1.2,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        parallel >= 2.2 && < 3.3,
+                        parsec >= 2 && < 4,
+                        stm,
+@@ -68,7 +68,7 @@ library
+ 
+   exposed-modules:     Graphics.Vty
+                        Graphics.Vty.Attributes
+-                       Graphics.Vty.Attributes.Color 
++                       Graphics.Vty.Attributes.Color
+                        Graphics.Vty.Attributes.Color240
+                        Graphics.Vty.Config
+                        Graphics.Vty.Error
+@@ -148,7 +148,7 @@ executable vty-mode-demo
+                        containers,
+                        microlens,
+                        microlens-mtl,
+-                       mtl >= 1.1.1.0 && < 2.3
++                       mtl >= 1.1.1.0 && < 2.4
+ 
+ executable vty-demo
+   main-is:             Demo.hs
+@@ -162,7 +162,7 @@ executable vty-demo
+                        containers,
+                        microlens,
+                        microlens-mtl,
+-                       mtl >= 1.1.1.0 && < 2.3
++                       mtl >= 1.1.1.0 && < 2.4
+ 
+ test-suite verify-using-mock-terminal
+   default-language:    Haskell2010
+@@ -189,7 +189,7 @@ test-suite verify-using-mock-terminal
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        terminfo >= 0.3 && < 0.5,
+                        unix,
+@@ -221,7 +221,7 @@ test-suite verify-terminal
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        terminfo >= 0.3 && < 0.5,
+                        text >= 0.11.3,
+                        unix,
+@@ -253,7 +253,7 @@ test-suite verify-display-attributes
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -278,7 +278,7 @@ test-suite verify-empty-image-props
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -305,7 +305,7 @@ test-suite verify-eval-terminfo-caps
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        terminfo >= 0.3 && < 0.5,
+                        text >= 0.11.3,
+                        unix,
+@@ -333,7 +333,7 @@ test-suite verify-image-ops
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -360,7 +360,7 @@ test-suite verify-image-trans
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -386,7 +386,7 @@ test-suite verify-inline
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -413,7 +413,7 @@ test-suite verify-parse-terminfo-caps
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        terminfo >= 0.3 && < 0.5,
+                        text >= 0.11.3,
+                        unix,
+@@ -444,7 +444,7 @@ test-suite verify-simple-span-generation
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -475,7 +475,7 @@ test-suite verify-crop-span-generation
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -506,7 +506,7 @@ test-suite verify-layers-span-generation
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -531,7 +531,7 @@ test-suite verify-color-mapping
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -556,7 +556,7 @@ test-suite verify-utf8-width
+                        bytestring,
+                        containers,
+                        deepseq >= 1.1 && < 1.5,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        text >= 0.11.3,
+                        unix,
+                        utf8-string >= 0.3 && < 1.1,
+@@ -587,7 +587,7 @@ test-suite verify-using-mock-input
+                        deepseq >= 1.1 && < 1.5,
+                        microlens,
+                        microlens-mtl,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        stm,
+                        terminfo >= 0.3 && < 0.5,
+                        text >= 0.11.3,
+@@ -622,7 +622,7 @@ test-suite verify-config
+                        deepseq >= 1.1 && < 1.5,
+                        microlens,
+                        microlens-mtl,
+-                       mtl >= 1.1.1.0 && < 2.3,
++                       mtl >= 1.1.1.0 && < 2.4,
+                        string-qq,
+                        terminfo >= 0.3 && < 0.5,
+                        text >= 0.11.3,