packages feed

ngx-export-tools 1.2.3.2 → 1.2.4

raw patch · 3 files changed

+29/−16 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,3 +1,9 @@+### 1.2.4++- Use qualified names of custom types in the implementation of typed services.+  This enables qualified imports of custom types in the module where the service+  gets instantiated.+ ### 1.2.3.2  - Suggest the synchronous initialization hook *ngxExportInitHook* from
NgxExport/Tools/SimpleService.hs view
@@ -54,15 +54,29 @@ -- -- This module implements a number of exporters for /simple services/. Here -- /simplicity/ means avoiding boilerplate code regarding to efficient reading--- of typed configurations and timed restarts of services. All simple services--- have type+-- of typed configurations and timed restarts of services. --+-- All simple services are classified as /untyped/ or /typed/. The untyped+-- services have type+-- -- @ -- 'ByteString' -> 'Prelude.Bool' -> 'IO' 'L.ByteString' -- @ ----- which corresponds to the type of usual services from module "NgxExport".+-- which corresponds to the type of usual services from module "NgxExport". The+-- typed services are backed by functions from module "NgxExport.Tools.Read"+-- and may have two different types: --+-- @+-- 'Read' a => a -> 'Prelude.Bool' -> 'IO' 'L.ByteString'+-- @+-- @+-- t'Data.Aeson.FromJSON' a => a -> 'Prelude.Bool' -> 'IO' 'L.ByteString'+-- @+--+-- The choice of a certain type of a typed service depends on the format in+-- which the typed data will be passed from the Nginx configuration.+-- -- Below is a simple example. -- -- ==== File /test_tools.hs/@@ -288,21 +302,14 @@         hasConf = isJust c         (sNameC, typeC, readConf, unreadableConfMsg) =             if hasConf-                then let (tName, isJSON) = first nameBase $ fromJust c-                     in (mkName $ "storage_" ++ tName ++ '_' : nameF-                        -- FIXME: using base name of the type means that it is-                        -- not possible to pass here qualified types from-                        -- external modules. Using showName instead of nameBase-                        -- won't help, as it adds static qualified names like-                        -- GHC.Types.Int that can be unexpected in the context-                        -- of the user's module scope, instead of adding the-                        -- dynamic namespace (possibly not qualified) specified-                        -- in the import clause of the user's module.-                        ,conT $ mkName tName+                then let ((tName, tNameBase), isJSON) =+                             first (id &&& nameBase) $ fromJust c+                     in (mkName $ "storage_" ++ tNameBase ++ '_' : nameF+                        ,conT tName                         ,if isJSON                              then [|readFromByteStringAsJSON|]                              else [|readFromByteString|]-                        ,"Configuration " ++ tName ++ " is not readable"+                        ,"Configuration " ++ tNameBase ++ " is not readable"                         )                 else undefined         initConf =
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-tools-version:                    1.2.3.2+version:                    1.2.4 synopsis:                   Extra tools for Nginx Haskell module description:                Extra tools for         <https://github.com/lyokha/nginx-haskell-module Nginx Haskell module>.