diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,11 @@
+### 1.6
+
+- Refactor module *NgxExport.Log.Gen*.
+- Add CPP macro *NGX_CSTUB* in module *NgxExport.Log.CLog* to work around the
+  lack of macro *\_\_HADDOCK_VERSION\_\_* in recent Haddock versions. Use this
+  macro in *simple/Makefile*: this must fix building the simple module with
+  documentation for dependencies.
+
 ### 1.5.2
 
 - Foreign calls were extracted in a separate module.
diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2022, Alexey Radkov. All rights reserved.
+Copyright 2022-2026, Alexey Radkov. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
diff --git a/NgxExport/Log.hs b/NgxExport/Log.hs
--- a/NgxExport/Log.hs
+++ b/NgxExport/Log.hs
@@ -3,7 +3,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  NgxExport.Log
--- Copyright   :  (c) Alexey Radkov 2022
+-- Copyright   :  (c) Alexey Radkov 2022-2026
 -- License     :  BSD-style
 --
 -- Maintainer  :  alexey.radkov@gmail.com
diff --git a/NgxExport/Log/CLog.hs b/NgxExport/Log/CLog.hs
--- a/NgxExport/Log/CLog.hs
+++ b/NgxExport/Log/CLog.hs
@@ -20,23 +20,21 @@
 -- detect that the code is being run by hls or haddock: the tools define their
 -- own C macro declarations __GHCIDE__ and __HADDOCK_VERSION__ respectively. To
 -- prevent interactive linking in ghci, pass one of the two macro declarations
--- in an appropriate option, e.g.
+-- (or macro NGX_CSTUB, see below) in an appropriate option, e.g.
 --
--- cabal repl --ghc-options=-D__GHCIDE__ --repl-options=-fobject-code
+-- cabal repl --ghc-options=-DNGX_CSTUB --repl-options=-fobject-code
+--
+-- In newer haddock releases (as of 2025), option __HADDOCK_VERSION__ gets no
+-- longer set. In this case, build haddocks with
+--
+-- cabal haddock --haddock-for-hackage --haddock-options=--optghc=-DNGX_CSTUB
 
-#if defined(__GHCIDE__) || defined(__HADDOCK_VERSION__)
+#if defined(__GHCIDE__) || defined(__HADDOCK_VERSION__) || defined(NGX_CSTUB)
 #define C_LOG_STUB(f) f :: CLogType; f _ _ _ _ = return ()
-#endif
-
-#if defined(__GHCIDE__) || defined(__HADDOCK_VERSION__)
 C_LOG_STUB(c_log)
-#else
-foreign import ccall unsafe "plugin_ngx_http_haskell_log" c_log :: CLogType
-#endif
-
-#if defined(__GHCIDE__) || defined(__HADDOCK_VERSION__)
 C_LOG_STUB(c_log_r)
 #else
+foreign import ccall unsafe "plugin_ngx_http_haskell_log" c_log :: CLogType
 foreign import ccall unsafe "plugin_ngx_http_haskell_log_r" c_log_r :: CLogType
 #endif
 
diff --git a/NgxExport/Log/Gen.hs b/NgxExport/Log/Gen.hs
--- a/NgxExport/Log/Gen.hs
+++ b/NgxExport/Log/Gen.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, TemplateHaskell, TupleSections, LambdaCase #-}
+{-# LANGUAGE CPP, TemplateHaskell, TupleSections #-}
 
 module NgxExport.Log.Gen where
 
@@ -8,6 +8,7 @@
 import           Control.Arrow
 import           Data.ByteString (ByteString)
 import qualified Data.ByteString.Lazy as L
+import           Data.List
 import           Data.Char
 
 #if MIN_VERSION_template_haskell(2,18,0)
@@ -18,21 +19,16 @@
 
 do
     TyConI (DataD _ _ _ _ lCs _) <- reify ''LogLevel
-    let lCons = map (\case
-                         NormalC con [] -> con
-                         _ -> undefined
-                    ) lCs
-        flr = mkName "logR"
-        lCons' = map ((, 'logG) . (id &&& toFuncName . nameBase)) lCons ++
-            map ((, flr) . (id &&& toFuncName . (++ "R") . nameBase)) lCons
-        toFuncName (h : t) = toLower h : t
-        toFuncName _ = undefined
+    let lCons = uncurry (++) $
+            (map (, 'logG) &&& map ((, 'logR) . second (++ "R")))
+            [id &&& toFuncName . nameBase $ con | NormalC con [] <- lCs]
+        toFuncName = maybe undefined (uncurry (:) . first toLower) . uncons
         flf = mkName "logFuncs"
     sequence $
         [sigD flf [t|[String]|]
         ,funD flf [clause []
                       (normalB $
-                          listE $ map (litE . stringL . snd . fst) lCons'
+                          listE $ map (litE . stringL . snd . fst) lCons
                       ) []
                   ]
         ]
@@ -47,16 +43,15 @@
                              ) []
                          ]
 #if MIN_VERSION_template_haskell(2,18,0)
-                         (Just $ "Logs a message with severity '" ++
-                             nameBase con ++ "' to the " ++
-                                 (if f == flr
-                                      then "request's "
-                                      else "global "
-                                 ) ++ "Nginx log.\n\n" ++
-                                 "This is the core function of the /" ++ fn ++
-                                 "/ handler."
+                         (Just $ let lType | f == 'logR = "request's"
+                                           | otherwise = "global"
+                                 in "Logs a message with severity '" ++
+                                        nameBase con ++ "' to the " ++
+                                        lType ++ " Nginx log.\n\n" ++
+                                        "This is the core function of the /" ++
+                                        fn ++ "/ handler."
                          ) [Just "Log message"]
 #endif
                 ]
-        ) lCons'
+        ) lCons
 
diff --git a/ngx-export-log.cabal b/ngx-export-log.cabal
--- a/ngx-export-log.cabal
+++ b/ngx-export-log.cabal
@@ -1,5 +1,5 @@
 name:                  ngx-export-log
-version:               1.5.2
+version:               1.6
 synopsis:    Native Nginx logging from configuration files and Haskell handlers
 description: Native Nginx logging from configuration files and Haskell handlers.
         .
@@ -8,14 +8,18 @@
 homepage:              http://github.com/lyokha/nginx-log-plugin
 license:               BSD3
 license-file:          LICENSE
-extra-source-files:    Changelog.md
+extra-doc-files:       Changelog.md
 author:                Alexey Radkov <alexey.radkov@gmail.com>
 maintainer:            Alexey Radkov <alexey.radkov@gmail.com>
 stability:             stable
-copyright:             2022 Alexey Radkov
+copyright:             2022-2026 Alexey Radkov
 category:              Network
 build-type:            Simple
 cabal-version:         1.20
+
+source-repository head
+  type:                git
+  location:            https://github.com/lyokha/nginx-log-plugin.git
 
 library
   default-language:    Haskell2010
