diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,8 @@
+### 1.7.9
+
+- Reify types of internal handlers from their signatures.
+- Dropped support for GHC versions older than *8.2*.
+
 ### 1.7.8
 
 - Refactored to avoid using *head* and *tail* as it triggers *x-partial*
diff --git a/NgxExport.hs b/NgxExport.hs
--- a/NgxExport.hs
+++ b/NgxExport.hs
@@ -100,20 +100,16 @@
 
 pattern I :: (Num i, Integral j) => i -> j
 pattern I i <- (fromIntegral -> i)
-#if MIN_TOOL_VERSION_ghc(8,2,1)
 {-# COMPLETE I :: Int #-}
 {-# COMPLETE I :: CInt #-}
 {-# COMPLETE I :: CSize #-}
-#endif
 
 pattern PtrLen :: Num l => Ptr s -> l -> (Ptr s, Int)
 pattern PtrLen s l <- (s, I l)
 
 pattern ToBool :: (Num i, Eq i) => Bool -> i
 pattern ToBool b <- (toBool -> b)
-#if MIN_TOOL_VERSION_ghc(8,2,1)
 {-# COMPLETE ToBool :: CUInt #-}
-#endif
 
 -- | The /4-tuple/ contains
 --   /(content, content-type, HTTP-status, response-headers)/.
@@ -255,21 +251,28 @@
         ++
         map (\(c, t) -> tySynD (mkName $ nameBase c) [] $ return t) tCons
 
-ngxExport' :: (Name -> Q Exp) ->
-    Name -> Name -> Name -> Q Type -> Name -> Q [Dec]
-ngxExport' m e a h t f = sequence
-    [sigD nameFt typeFt
-    ,funD nameFt $ body [|exportType $cefVar|]
-    ,ForeignD . ExportF CCall ftName nameFt <$> typeFt
-    ,sigD nameFta typeFta
-    ,funD nameFta $ body [|exportTypeAmbiguity $(conE a)|]
-    ,ForeignD . ExportF CCall ftaName nameFta <$> typeFta
-    ,sigD nameF t
-    ,funD nameF $ body [|$(varE h) $efVar|]
-    ,ForeignD . ExportF CCall fName nameF <$> t
-    ]
-    where efVar   = m f
-          cefVar  = conE e `appE` efVar
+-- Exporter -> Ambiguity -> Handler impl -> Handler name (Function) -> Decls
+type NgxExportDec = Name -> Name -> Name -> Name -> Q [Dec]
+
+ngxExport' :: (Name -> Q Exp) -> NgxExportDec
+ngxExport' mode e a h f = do
+#if MIN_VERSION_template_haskell(2,16,0)
+    AppT (AppT ArrowT _) typeF@(ConT _) <- reifyType h
+#else
+    VarI _ (AppT (AppT ArrowT _) typeF@(ConT _)) _ <- reify h
+#endif
+    sequence
+        [sigD nameFt typeFt
+        ,funD nameFt $ body [|exportType $(conE e `appE` modeF)|]
+        ,export ftName nameFt <$> typeFt
+        ,sigD nameFta typeFta
+        ,funD nameFta $ body [|exportTypeAmbiguity $(conE a)|]
+        ,export ftaName nameFta <$> typeFta
+        ,sigD nameF $ return typeF
+        ,funD nameF $ body [|$(varE h) $modeF|]
+        ,return $ export fName nameF typeF
+        ]
+    where modeF   = mode f
           fName   = "ngx_hs_" ++ nameBase f
           nameF   = mkName fName
           ftName  = "type_" ++ fName
@@ -279,11 +282,12 @@
           nameFta = mkName ftaName
           typeFta = [t|IO CInt|]
           body b  = [clause [] (normalB b) []]
+          export  = ((ForeignD .) .) . ExportF CCall
 
-ngxExport :: Name -> Name -> Name -> Q Type -> Name -> Q [Dec]
+ngxExport :: NgxExportDec
 ngxExport = ngxExport' varE
 
-ngxExportC :: Name -> Name -> Name -> Q Type -> Name -> Q [Dec]
+ngxExportC :: NgxExportDec
 ngxExportC = ngxExport' $ infixE (Just $ varE 'const) (varE '(.)) . Just . varE
 
 -- $exporters
@@ -383,8 +387,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportSS :: Name -> Q [Dec]
-ngxExportSS = ngxExport 'SS 'Unambiguous
-    'sS [t|SSImpl|]
+ngxExportSS =
+    ngxExport 'SS 'Unambiguous 'sS
 
 -- | Exports a function of type
 --
@@ -394,8 +398,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportSSS :: Name -> Q [Dec]
-ngxExportSSS = ngxExport 'SSS 'Unambiguous
-    'sSS [t|SSSImpl|]
+ngxExportSSS =
+    ngxExport 'SSS 'Unambiguous 'sSS
 
 -- | Exports a function of type
 --
@@ -405,8 +409,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportSLS :: Name -> Q [Dec]
-ngxExportSLS = ngxExport 'SLS 'Unambiguous
-    'sLS [t|SLSImpl|]
+ngxExportSLS =
+    ngxExport 'SLS 'Unambiguous 'sLS
 
 -- | Exports a function of type
 --
@@ -416,8 +420,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportBS :: Name -> Q [Dec]
-ngxExportBS = ngxExport 'BS 'Unambiguous
-    'bS [t|BSImpl|]
+ngxExportBS =
+    ngxExport 'BS 'Unambiguous 'bS
 
 -- | Exports a function of type
 --
@@ -427,8 +431,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportBSS :: Name -> Q [Dec]
-ngxExportBSS = ngxExport 'BSS 'Unambiguous
-    'bSS [t|BSSImpl|]
+ngxExportBSS =
+    ngxExport 'BSS 'Unambiguous 'bSS
 
 -- | Exports a function of type
 --
@@ -438,8 +442,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportBLS :: Name -> Q [Dec]
-ngxExportBLS = ngxExport 'BLS 'Unambiguous
-    'bLS [t|BLSImpl|]
+ngxExportBLS =
+    ngxExport 'BLS 'Unambiguous 'bLS
 
 -- | Exports a function of type
 --
@@ -449,8 +453,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportYY :: Name -> Q [Dec]
-ngxExportYY = ngxExport 'YY 'YYSync
-    'yY [t|YYImpl|]
+ngxExportYY =
+    ngxExport 'YY 'YYSync 'yY
 
 -- | Exports a function of type
 --
@@ -460,8 +464,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportBY :: Name -> Q [Dec]
-ngxExportBY = ngxExport 'BY 'Unambiguous
-    'bY [t|BYImpl|]
+ngxExportBY =
+    ngxExport 'BY 'Unambiguous 'bY
 
 -- | Exports a function of type
 --
@@ -471,8 +475,8 @@
 --
 -- for using in directive __/haskell_run/__.
 ngxExportIOYY :: Name -> Q [Dec]
-ngxExportIOYY = ngxExportC 'IOYY 'IOYYSync
-    'ioyY [t|YYImpl|]
+ngxExportIOYY =
+    ngxExportC 'IOYY 'IOYYSync 'ioyY
 
 -- | Exports a function of type
 --
@@ -482,8 +486,8 @@
 --
 -- for using in directive __/haskell_run_async/__.
 ngxExportAsyncIOYY :: Name -> Q [Dec]
-ngxExportAsyncIOYY = ngxExportC 'IOYY 'IOYYAsync
-    'asyncIOYY [t|AsyncIOYYImpl|]
+ngxExportAsyncIOYY =
+    ngxExportC 'IOYY 'IOYYAsync 'asyncIOYY
 
 -- | Exports a function of type
 --
@@ -496,8 +500,8 @@
 -- The first argument of the exported function contains buffers of the client
 -- request body.
 ngxExportAsyncOnReqBody :: Name -> Q [Dec]
-ngxExportAsyncOnReqBody = ngxExport 'IOYYY 'Unambiguous
-    'asyncIOYYY [t|AsyncIOYYYImpl|]
+ngxExportAsyncOnReqBody =
+    ngxExport 'IOYYY 'Unambiguous 'asyncIOYYY
 
 -- | Exports a function of type
 --
@@ -511,8 +515,8 @@
 -- The boolean argument of the exported function marks that the service is
 -- being run for the first time.
 ngxExportServiceIOYY :: Name -> Q [Dec]
-ngxExportServiceIOYY = ngxExport 'IOYY 'IOYYAsync
-    'asyncIOYY [t|AsyncIOYYImpl|]
+ngxExportServiceIOYY =
+    ngxExport 'IOYY 'IOYYAsync 'asyncIOYY
 
 -- | Exports a function of type
 --
@@ -523,8 +527,8 @@
 -- for using in directives __/haskell_content/__ and
 -- __/haskell_static_content/__.
 ngxExportHandler :: Name -> Q [Dec]
-ngxExportHandler = ngxExport 'Handler 'Unambiguous
-    'handler [t|HandlerImpl|]
+ngxExportHandler =
+    ngxExport 'Handler 'Unambiguous 'handler
 
 -- | Exports a function of type
 --
@@ -535,8 +539,8 @@
 -- for using in directives __/haskell_content/__ and
 -- __/haskell_static_content/__.
 ngxExportDefHandler :: Name -> Q [Dec]
-ngxExportDefHandler = ngxExport 'YY 'YYDefHandler
-    'defHandler [t|DefHandlerImpl|]
+ngxExportDefHandler =
+    ngxExport 'YY 'YYDefHandler 'defHandler
 
 -- | Exports a function of type
 --
@@ -546,8 +550,8 @@
 --
 -- for using in directive __/haskell_unsafe_content/__.
 ngxExportUnsafeHandler :: Name -> Q [Dec]
-ngxExportUnsafeHandler = ngxExport 'UnsafeHandler 'Unambiguous
-    'unsafeHandler [t|UnsafeHandlerImpl|]
+ngxExportUnsafeHandler =
+    ngxExport 'UnsafeHandler 'Unambiguous 'unsafeHandler
 
 -- | Exports a function of type
 --
@@ -557,8 +561,8 @@
 --
 -- for using in directive __/haskell_async_content/__.
 ngxExportAsyncHandler :: Name -> Q [Dec]
-ngxExportAsyncHandler = ngxExport 'AsyncHandler 'Unambiguous
-    'asyncHandler [t|AsyncHandlerImpl|]
+ngxExportAsyncHandler =
+    ngxExport 'AsyncHandler 'Unambiguous 'asyncHandler
 
 -- | Exports a function of type
 --
@@ -571,8 +575,8 @@
 -- The first argument of the exported function contains buffers of the client
 -- request body.
 ngxExportAsyncHandlerOnReqBody :: Name -> Q [Dec]
-ngxExportAsyncHandlerOnReqBody = ngxExport 'AsyncHandlerRB 'Unambiguous
-    'asyncHandlerRB [t|AsyncHandlerRBImpl|]
+ngxExportAsyncHandlerOnReqBody =
+    ngxExport 'AsyncHandlerRB 'Unambiguous 'asyncHandlerRB
 
 -- | Exports a function of type
 --
@@ -583,8 +587,8 @@
 -- for using in directives __/haskell_service_hook/__ and
 -- __/haskell_service_update_hook/__.
 ngxExportServiceHook :: Name -> Q [Dec]
-ngxExportServiceHook = ngxExportC 'IOYY 'IOYYSync
-    'ioyYWithFree [t|YYImpl|]
+ngxExportServiceHook =
+    ngxExportC 'IOYY 'IOYYSync 'ioyYWithFree
 
 data ServiceHookInterrupt = ServiceHookInterrupt
 
@@ -787,7 +791,7 @@
 {-# INLINE safeAsyncYYHandler #-}
 
 fromHTTPHeaders :: HTTPHeaders -> L.ByteString
-fromHTTPHeaders = L.fromChunks . foldr (\(z -> a, z -> b) -> ([a, b] ++)) []
+fromHTTPHeaders = L.fromChunks . foldr (\(a, b) -> (z a :) . (z b :)) []
     where z s | B.null s = B.singleton 0
               | otherwise = s
 
diff --git a/ngx-export.cabal b/ngx-export.cabal
--- a/ngx-export.cabal
+++ b/ngx-export.cabal
@@ -1,5 +1,5 @@
 name:                       ngx-export
-version:                    1.7.8
+version:                    1.7.9
 synopsis:                   Helper module for Nginx haskell module
 description:                Helper module for
         <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.
@@ -17,7 +17,7 @@
 
 library
   default-language:         Haskell2010
-  build-depends:            base >= 4.9 && < 5
+  build-depends:            base >= 4.10 && < 5
                           , template-haskell >= 2.11.0.0
                           , bytestring >= 0.10.0.0
                           , monad-loops >= 0.4.2
@@ -31,6 +31,4 @@
                             Paths_ngx_export
 
   ghc-options:             -Wall
-  if impl(ghc < 8.2)
-    ghc-options:           -Wno-incomplete-patterns
 
