diff --git a/om-elm.cabal b/om-elm.cabal
--- a/om-elm.cabal
+++ b/om-elm.cabal
@@ -1,6 +1,6 @@
 cabal-version:       3.0
 name:                om-elm
-version:             2.0.0.2
+version:             2.0.0.5
 synopsis:            Haskell utilities for building embedded Elm programs.
 description:         This package provides utilities for serving Elm programs
                      directly from your Haskell binary. It uses TemplateHaskell
@@ -37,18 +37,18 @@
   -- other-modules:       
   -- other-extensions:    
   build-depends:
-    , Cabal            >= 3.2.1.0   && < 3.3
-    , base             >= 4.14      && < 4.15
-    , bytestring       >= 0.10.10.1 && < 0.11
-    , containers       >= 0.6.2.1   && < 0.7
-    , directory        >= 1.3.6.0   && < 1.4
+    , Cabal            >= 3.8.1.0   && < 3.11
+    , base             >= 4.15.1.0  && < 4.20
+    , bytestring       >= 0.11.3.1  && < 0.12
+    , containers       >= 0.6.4.1   && < 0.7
+    , directory        >= 1.3.6.2   && < 1.4
     , http-types       >= 0.12.3    && < 0.13
     , safe             >= 0.3.19    && < 0.4
-    , safe-exceptions  >= 0.1.7.1   && < 0.2
-    , template-haskell >= 2.16.0.0  && < 2.17
-    , text             >= 1.2.4.0   && < 1.3
-    , unix             >= 2.7.2.2   && < 2.8
-    , wai              >= 3.2.2.1   && < 3.3
+    , safe-exceptions  >= 0.1.7.3   && < 0.2
+    , template-haskell >= 2.17.0.0  && < 2.22
+    , text             >= 2.0.1     && < 2.2
+    , unix             >= 2.7.2.2   && < 2.9
+    , wai              >= 3.2.3     && < 3.3
   hs-source-dirs: src
   default-language: Haskell2010
 
diff --git a/src/System/Elm/Middleware.hs b/src/System/Elm/Middleware.hs
--- a/src/System/Elm/Middleware.hs
+++ b/src/System/Elm/Middleware.hs
@@ -53,7 +53,7 @@
   defaultProgramDb, requireProgram, simpleProgram)
 import Distribution.Simple.Setup (configVerbosity, fromFlagOrDefault)
 import Distribution.Verbosity (normal)
-import Language.Haskell.TH (Q, TExp, runIO)
+import Language.Haskell.TH (Code(examineCode), Q, TExp, runIO)
 import Language.Haskell.TH.Syntax (addDependentFile)
 import Network.HTTP.Types (methodNotAllowed405, ok200)
 import Network.Wai (Application, Middleware, pathInfo, requestMethod,
@@ -135,28 +135,30 @@
   where
     {- | Construct the middleware from a set of compiled elm resources. -}
     buildMiddleware :: [([String], (String, String))] -> Q (TExp Middleware)
-    buildMiddleware resources = [||
-        let
-          apps = Map.fromList[
-              (uriPath, buildApp contentType content)
-              | (fmap T.pack -> uriPath, (contentType, content)) <- resources
-            ]
-          {- | Build the application that serves a single elm resource. -}
-          buildApp :: String -> String -> Application
-          buildApp contentType content req respond = respond $
-            case requestMethod req of
-              "GET" ->
-                responseLBS
-                  ok200
-                  [("Content-Type", fromString contentType)]
-                  (fromString content)
-              _ -> responseLBS methodNotAllowed405 [("Allow", "GET")] ""
-        in
-          \downstream req respond ->
-            case Map.lookup (pathInfo req) apps of
-              Nothing -> downstream req respond
-              Just app -> app req respond
-      ||]
+    buildMiddleware resources =
+      examineCode
+        [||
+          let
+            apps = Map.fromList[
+                (uriPath, buildApp contentType content)
+                | (fmap T.pack -> uriPath, (contentType, content)) <- resources
+              ]
+            {- | Build the application that serves a single elm resource. -}
+            buildApp :: String -> String -> Application
+            buildApp contentType content req respond = respond $
+              case requestMethod req of
+                "GET" ->
+                  responseLBS
+                    ok200
+                    [("Content-Type", fromString contentType)]
+                    (fromString content)
+                _ -> responseLBS methodNotAllowed405 [("Allow", "GET")] ""
+          in
+            \downstream req respond ->
+              case Map.lookup (pathInfo req) apps of
+                Nothing -> downstream req respond
+                Just app -> app req respond
+        ||]
 
     compileElm :: [String] -> FilePath -> Q (String, String)
     compileElm uriPath elmFile = do
@@ -165,17 +167,20 @@
           void . tryAny $ removeDirectoryRecursive buildDir
           createDirectory buildDir
           putStrLn $ "Compiling elm file: " ++ elmFile
-          forkProcess (executeFile "elm" True ([
-              "make",
-              elmFile,
-              "--output=" <> buildFile
-            ] ++ bool [] ["--debug"] debug) Nothing) >>= getProcessStatus True True >>= \case
-              Nothing -> fail "elm should have ended."
-              Just (Exited ExitSuccess) ->
-                (contentType,)
-                . BS8.unpack
-                <$> BS.readFile buildFile
-              e -> fail $ "elm failed with: " ++ show e
+          forkProcess
+            (
+              executeFile "elm" True ([
+                  "make",
+                  elmFile,
+                  "--output=" <> buildFile
+                ] ++ bool [] ["--debug"] debug) Nothing
+            ) >>= getProcessStatus True True >>= \case
+                Nothing -> fail "elm should have ended."
+                Just (Exited ExitSuccess) ->
+                  (contentType,)
+                  . BS8.unpack
+                  <$> BS.readFile buildFile
+                e -> fail $ "elm failed with: " ++ show e
       where
         {- |
           The name of the build directory. We have to have a build
